Python 2.2 __slots__ Bug?

Eric Texier erict at millfilm.co.uk
Fri Jun 28 04:36:20 EDT 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
doStuff(x)
print "I'm fine."
doStuff(x+1)
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 sourceforge.net; 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