From: Guido van Rossum Date: Sat, 18 Aug 2001 21:00:39 +0000 (+0000) Subject: Inspired by Greg Stein's proposed simplification of the _closesocket X-Git-Tag: v2.2a3~440 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=112ea6bfa61e67516f8ab7c0b5b46911d5f7e060;p=thirdparty%2FPython%2Fcpython.git Inspired by Greg Stein's proposed simplification of the _closesocket class, I came up with an even simpler solution: raise the error in __getattr__(). --- diff --git a/Lib/socket.py b/Lib/socket.py index ce72b65c6e4c..ec8d61092b93 100644 --- a/Lib/socket.py +++ b/Lib/socket.py @@ -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: