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 glchapman
Recipients
Date 2001-05-01.00:14:28
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
In Python 2.1, when calling the builtin getattr 
function and supplying the (optional) default 
argument, this default is returned on any exception 
raised during PyObject_GetAttr, even if the exception 
is not an AttributeError.  I did not expect this 
behavior after reading the getattr documentation.  Is 
this the  intended behavior?  (If so, I think the 
documentation should be made clearer on this point.)

Example (providing a non-string as the attribute name):

>>> class Test:
... 	pass
... 
>>> t = Test()
>>> getattr(t, 1, "hello")
'hello'
>>> 
History
Date User Action Args
2007-08-23 13:54:25adminlinkissue420304 messages
2007-08-23 13:54:25admincreate