simple StackOverflower

Christian Tismer tismer at tismer.com
Tue Mar 21 10:38:32 EST 2000


Berthold Hoellmann wrote:
> 
> Michal Bozon wrote:
> >
> > Oooooooops.
> > Correction:
> >
> >  class StackOverflower:
> >      ":-)"
> >      def __init__(self):
> >          self.__init__()
> 
> With
> 
> >python
> Python 1.5.2 (#3, Jul  7 1999, 08:48:09) [C] on sunos5
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> >>> class StackOverflower:
> ...      ":-)"
> ...      def __init__(self):
> ...          self.__init__()
> ...
> >>> a=StackOverflower()
> 
> I get:
> 
> Traceback (innermost last):
>   File "<stdin>", line 4, in __init__

That's the desired behavior.
Python-1.5.2 was compiled with recursion limit==10000. This is
ok with some architecture, and not with some others.
Especially on windows it is funny:
Python-1.5.2 will crash with the above example if you use
the precompiled binary.
If you compile it with Visual Studio 6.0, your code will
not crash. This is a "race condition" :-)
VC++6.0 optimizes *one* stack entry away, and that's exactly
the one that makes a crash into an exception. :-)

ciao - chris

-- 
Christian Tismer             :^)   <mailto:tismer at appliedbiometrics.com>
Applied Biometrics GmbH      :     Have a break! Take a ride on Python's
Kaunstr. 26                  :    *Starship* http://starship.python.net
14163 Berlin                 :     PGP key -> http://wwwkeys.pgp.net
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