need help checking for stack overflow in Win32

Thomas Heller heller at
Tue Jun 1 13:18:40 EDT 1999

Guido van Rossum <guido at> wrote in message
news:5lk8to3su3.fsf at
> I could use some help from someone with a little time, some knowledge
> of Python internals, and some Win32 C expertise.  On Win32 platforms,
> infinite recursion causes an Application Error (a fatal windows
> error).  There is some machinery in Python to check for this
> condition, but apparently it doesn't work on Win32.  Please help!
> --Guido van Rossum (home page:

I've just took a first look after this (under NT4 SP4, will also
have to check under Win95):

In principle the machinery seems to work, but the default reserved
stack size of 1MB is too small for the recursion limit of 10000
(a stack frame is 332 byte, and 10000 * 332 = 3.32 MB).
The stack will grow up to the reserved limit, but not beyond...
AFAIK the options are:
- Reserve a stack of about 4MB, or
- Decrease MAX_RECURSION_DEPS to 2500


Thomas Heller

More information about the Python-list mailing list