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:
Guido van Rossum 2001-08-18 21:00:39 +00:00
parent aa32070f4d
commit 112ea6bfa6
1 changed files with 1 additions and 5 deletions

View File

@ -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: