Python 2.2 __slots__ Bug?

Eric Texier erict at
Fri Jun 28 10:36:20 CEST 2002

I am running on [GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2
and your script DOESN'T   crash.
I am a  notSoNewPythonWriter/longTimeC++Writer and I am always
concern  about memory(I guess like anybody).
I just started writing a big app in python,  and  for
now I decided to not be to worry about memory and to rely as much as
possible on python.
My question is simple: Will it crash the same way if the range call what
in a function and I let python cleanning after itself:

def doStuff(x):
    o = None
    for i in xrange(x):
        o = foo(o)

# x = 43550
x = 3
print "I'm fine."
print "I'm dead."

Glyph Lefkowitz wrote:

> I'm sorry if this is a known issue.  I couldn't get through to the bugtracker
> at; it's abysmally slow and I stopped waiting for the search to
> run after about 15 minutes.  Searches on google yielded nothing similar for
> 'python __slots__ bug'.
> I think I have discovered a weird bug in the Python interpreter.  Under
> Python2.2, when I run this script:
>     class foo(object):
>         def __init__(self, n):
>             self.n = n
>         __slots__ = ['n']
>     o = None
>     for i in xrange(43550):
>         o = foo(o)
>     del o
>     o = None
>     print "I'm fine."
>     for i in xrange(43551):
>         o = foo(o)
>     del o
>     print "I'm dead."

More information about the Python-list mailing list