classification
Title: recursive __attribute__ -> Fatal Python error: Cannot recover from stack overflow.
Type: behavior Stage:
Components: Interpreter Core Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Interpreter aborts when chaining an infinite number of exceptions
View: 6028
Assigned To: Nosy List: ezio.melotti, kaizhu, loewis, pitrou, roger.serwy, terry.reedy
Priority: normal Keywords:

Created on 2009-11-17 11:01 by kaizhu, last changed 2011-12-24 22:47 by terry.reedy. This issue is now closed.

Messages (5)
msg95381 - (view) Author: kai zhu (kaizhu) Date: 2009-11-17 11:01
Python 3.1.1 (r311:74480, Sep 13 2009, 17:17:12)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(object):
...   def __getattribute__(self, attr):
...     try: return object.__getattribute__(attr)
...     except: return self.x
...
>>> Foo().y
Fatal Python error: Cannot recover from stack overflow.
Aborted
$

python2.6 recovers from above w/ a RuntimeError
msg95382 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2009-11-17 11:10
This is normal. By doing "except: return self.x", you are reinvoking
__getattribute__ as soon as the RuntimeError is raised, and forcing the
interpreter into another infinite recursion.
msg150233 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2011-12-24 18:57
> This is normal.

Can this be closed then?
msg150236 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2011-12-24 20:32
This is related to #13644.
msg150239 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-12-24 22:47
This seems to be a duplicate of 3555 and 6028. I am redirecting to the latter because is has a proposed patch.
History
Date User Action Args
2011-12-24 22:47:36terry.reedysetstatus: open -> closed

superseder: Interpreter aborts when chaining an infinite number of exceptions
nosy: + terry.reedy
messages: + msg150239

resolution: duplicate
type: crash -> behavior
2011-12-24 20:32:45roger.serwysetnosy: + roger.serwy
messages: + msg150236
2011-12-24 18:57:44ezio.melottisetnosy: + ezio.melotti

messages: + msg150233
versions: + Python 3.2, Python 3.3, - Python 3.1
2009-11-17 11:10:23pitrousetnosy: + loewis, pitrou
messages: + msg95382
2009-11-17 11:01:32kaizhucreate