This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author quinn_dunkan
Recipients
Date 2002-01-17.02:52:03
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Curse me for a fool.  I reported this exact same thing
in getattr but failed to
look 30 lines down to notice hasattr.

hasattr(foo, 'bar') catches all exceptions.  I think it
should only catch 
AttributeError.  Example:

>>> class Foo:
...     def __getattr__(self, attr):
...         assert 0
... 
>>> f = Foo()
>>> hasattr(f, 'bar')
0               # should have gotten an AssertionError
>>>

This patch makes hasattr only catch AttributeError.  I
changed the 
docstring to reflect that, and also changed the getattr
docstring
to read a little more naturally.
History
Date User Action Args
2007-08-23 15:10:34adminlinkissue504714 messages
2007-08-23 15:10:34admincreate