This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author josiahcarlson
Recipients
Date 2005-01-29.20:16:15
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=341410

The fact that an error occurs is not surprising.  Python is
limited by the C stack size, which from what I understand is
well below 2GB.

The fact that it gets to nearly 30k levels of recursion for
you is amazing to me, the most used platform (Windows) can
only ever get to around 5500 levels before they get
"MemoryError: stack overflow" exceptions.

I believe that the reason you are getting a segfault on
linux is the way the linux malloc() and free() work. 
Specifically, malloc() on linux will give you a pointer to
memory, regardless of whether it is available.  If your
program has used up all of its stack space, and you need
more, the pointer will be invalid.  If Python happens to
call a free() before you actually access the invalid
pointer, everything will work.  If Python doesn't call
free() before you access the invalid pointer, you get a
segfault.

Unfortunately, there is no way that Python (or any other
program on linux) can know that the pointer it has gotten
from malloc() is invalid.

Furthermore, as per the docs here:
http://docs.python.org/lib/module-sys.html

"
setrecursionlimit(limit)
Set the maximum depth of the Python interpreter stack to
limit. This limit prevents infinite recursion from causing
an overflow of the C stack and crashing Python.

The highest possible limit is platform-dependent. A user may
need to set the limit higher when she has a program that
requires deep recursion and a platform that supports a
higher limit. This should be done with care, because a
too-high limit can lead to a crash."

I would suggest that this bug be closed as "3rd party, will
not fix", and suggest the OP read the documentation.
History
Date User Action Args
2007-08-23 14:29:08adminlinkissue1110055 messages
2007-08-23 14:29:08admincreate