[issue9744] calling __getattribute__ with wrong instance causes hang up

Andreas Stührk report at bugs.python.org
Fri Sep 3 12:23:00 CEST 2010


Andreas Stührk <andy-python at hammerhartes.de> added the comment:

Actually, Python behaves the way you expect it. The problem is that when that exception is created, Python tries to look up the involved class names. To do that, it tries to get the "__class__" attribute (hapens in `getinstclassname()`, which will call again into A's `__getattibute__`, which will raise again, and for that new exception, "__class__" will be looked up, which will call into `__getattribute__` again, which will raise again and that goes on and on until finally the recursion limit is hit and a recursion error is raised. That recursion error will be discarded by `getinstclassname()`. Hence it's not really a hangup, it just takes a lot of time due to the recursive calls. Try your example with a recursion limit set to a really small value to see the expected behaviour.

----------
nosy: +Trundle

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9744>
_______________________________________


More information about the Python-bugs-list mailing list