Why are some infinite recursion stack overflows hard to deal with?

Moshe Zadka moshez at math.huji.ac.il
Wed Jul 12 10:54:35 EDT 2000


On 12 Jul 2000, Alex wrote:

> 
> Probably everyone who could answer this is busy on the python-dev list,
> but I'll ask now, anyway.  Why are some infinite recursion stack
> overflows harder for python to deal with than others?  This is an
> example from the bugs list:
> 
> class T:
>     def __str__(self):
>         print self
> print T()
> 
> Is this just dumping stuff on the stack faster than a vanilla infinite
> recursion, causing an overflow before the maximum recursion depth is
> reached?  If so, what sort of stuff is it dumping?  And where would I
> look in the source to understand this sort of thing?

Python has a hack to try to deal with that: it checks bounds on the
recursion itself. However, Python's guess is a bit off on windows.

-- 
Moshe Zadka <moshez at math.huji.ac.il>
There is no GOD but Python, and HTTP is its prophet.
http://advogato.org/person/moshez





More information about the Python-list mailing list