py2.1->py2.3.3 __getattr__ confusion
__peter__ at web.de
Mon Jul 5 11:16:27 CEST 2004
Holger Joukl wrote:
> Peter wrote:
>>That is, starting with Python 2.3 the repr() and str() functions no longer
>>mask exceptions other than AttributeError. Solution: make sure you raise
Contrary to my previous post, the culprit seems to be getattr() rather than
Comment for Revision 2.241:
"SF patch #471852 (anonymous) notes that getattr(obj, name, default)
masks any exception, not just AttributeError. Fix this."
>>AttributeError instead of the current KeyError for nonexistent attributes.
> Thank you! Hmm, did I overlook that in the what?s new/release notes?
I would think that code built on the assumption that arbitrary Exceptions
get masked by getattr() is buggy and above quote from cvs supports this
view. It's not a feature, it's a bug (fix).
More information about the Python-list