need help checking for stack overflow in Win32

Christian Tismer tismer at
Wed Jun 2 06:09:11 EDT 1999

Mark Hammond wrote:
> Actually, I was about to post this yesterday, and to prove my point I wrote:
> def die():
>     die()
> Expecting to see the crash.  I was then going to go into a rant about how
> win32api.Apply would actually let you catch this (and any other Win32)
> exception as a temporary solution.
> But it worked correctly - ie, Python raised a RuntimeError: Max Recursion.
> So I guessed that 1.5.2 had fixed this, presumably by reducing the recursion
> count for Win32.  Apparently not!

Nope. The trap is:
You compiled with VC++ 6.0 which has better register spilling.
Therefore, recusion costs only 100 bytes, not 104.
Not calculate 104 * 10000 and you see why 1 MB stack
lets it crash.

I submitted a patch program for this kind of
problems, so I think there is no need to change
Python 1.5.2 at all.

cheers - chris

Christian Tismer             :^)   <mailto:tismer at>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaiserin-Augusta-Allee 101   :    *Starship*
10553 Berlin                 :     PGP key ->
PGP Fingerprint       E182 71C7 1A9D 66E9 9D15  D3CC D4D7 93E2 1FAE F6DF
     we're tired of banana software - shipped green, ripens at home

More information about the Python-list mailing list