mirror of
https://github.com/python/cpython.git
synced 2025-12-15 21:44:50 +00:00
Inspired by Greg Stein's proposed simplification of the _closesocket
class, I came up with an even simpler solution: raise the error in __getattr__().
This commit is contained in:
parent
aa32070f4d
commit
112ea6bfa6
1 changed files with 1 additions and 5 deletions
|
|
@ -155,13 +155,9 @@ class _socketobject:
|
|||
|
||||
class _closedsocket:
|
||||
|
||||
def _bummer(self):
|
||||
def __getattr__(self, name):
|
||||
raise error(9, 'Bad file descriptor')
|
||||
|
||||
_s = "def %s(self, *args): self._bummer()\n\n"
|
||||
for _m in _socketmethods:
|
||||
exec _s % _m
|
||||
|
||||
|
||||
class _fileobject:
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue