]> granicus.if.org Git - python/commitdiff
Bugfix to ESR's code reported by himself: should use hasattr() to test
authorGuido van Rossum <guido@python.org>
Mon, 22 Jun 1998 15:46:26 +0000 (15:46 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 22 Jun 1998 15:46:26 +0000 (15:46 +0000)
for presence unread, not getattr()!

Lib/rfc822.py

index 87d7d394b9d09b9e906db4e2de8237f00bad235e..fc244c5b88c7ce12620a6fada7ee5bada240449f 100644 (file)
@@ -160,7 +160,7 @@ class Message:
                 else:
                     self.status = 'Non-header line where header expected'
                 # Try to undo the read.
-                if getattr(self.fp, 'unread'):
+                if hasattr(self.fp, 'unread'):
                     self.fp.unread(line)
                 elif self.seekable:
                     self.fp.seek(-len(line), 1)