From: Guido van Rossum Date: Mon, 22 Jun 1998 15:46:26 +0000 (+0000) Subject: Bugfix to ESR's code reported by himself: should use hasattr() to test X-Git-Tag: v1.5.2a1~436 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5430b432e6a40c45b790afb2e21668d8164342a6;p=thirdparty%2FPython%2Fcpython.git Bugfix to ESR's code reported by himself: should use hasattr() to test for presence unread, not getattr()! --- diff --git a/Lib/rfc822.py b/Lib/rfc822.py index 87d7d394b9d0..fc244c5b88c7 100644 --- a/Lib/rfc822.py +++ b/Lib/rfc822.py @@ -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)