diff Lib/socket.py @ 65707:cff78ffb932a

Issue #10093: ResourceWarnings are now issued when files and sockets are deallocated without explicit closing. These warnings are silenced by default, except in pydebug mode.
author Antoine Pitrou <solipsis@pitrou.net>
date Fri, 29 Oct 2010 10:38:18 +0000
parents 1875bfed5689
children f4a808f5a66d
line wrap: on
line diff
--- a/Lib/socket.py	Fri Oct 29 09:08:19 2010 +0000
+++ b/Lib/socket.py	Fri Oct 29 10:38:18 2010 +0000
@@ -108,7 +108,7 @@
         if s.startswith("<socket object"):
             s = "<%s.%s%s%s" % (self.__class__.__module__,
                                 self.__class__.__name__,
-                                (self._closed and " [closed] ") or "",
+                                getattr(self, '_closed', False) and " [closed] " or "",
                                 s[7:])
         return s