Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue7338] recursive __attribute__ -> Fatal Python error: Cannot recover from stack overflow.

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 17, 2009, 3:01 AM

Post #1 of 2 (195 views)
Permalink
[issue7338] recursive __attribute__ -> Fatal Python error: Cannot recover from stack overflow.

New submission from kai zhu <kaizhu256 [at] gmail>:

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

----------
components: Interpreter Core
messages: 95381
nosy: kaizhu
severity: normal
status: open
title: recursive __attribute__ -> Fatal Python error: Cannot recover from stack overflow.
type: crash
versions: Python 3.1

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7338>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 17, 2009, 3:10 AM

Post #2 of 2 (174 views)
Permalink
[issue7338] recursive __attribute__ -> Fatal Python error: Cannot recover from stack overflow. [In reply to]

Antoine Pitrou <pitrou [at] free> added the comment:

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.

----------
nosy: +loewis, pitrou

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue7338>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.