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
|
@ -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…
Reference in New Issue