J
John Hunter
I'm trying to understand why some code from a module I'm using is
failing on 2.3 but working on 2.3. Here is the minimal example that
replicates the problem
class Results(object):
__slots__ = ( "__doinit" )
def __new__(cls):
retobj = object.__new__(cls)
retobj.__doinit = True
return retobj
x = Results()
On python2.2, this fails with
mother:~/tmp> python2.2 test.py
Traceback (most recent call last):
File "test.py", line 8, in ?
x = Results()
File "test.py", line 5, in __new__
retobj.__doinit = True
AttributeError: 'Results' object has no attribute '_Results__doinit'
failing on 2.3 but working on 2.3. Here is the minimal example that
replicates the problem
class Results(object):
__slots__ = ( "__doinit" )
def __new__(cls):
retobj = object.__new__(cls)
retobj.__doinit = True
return retobj
x = Results()
On python2.2, this fails with
mother:~/tmp> python2.2 test.py
Traceback (most recent call last):
File "test.py", line 8, in ?
x = Results()
File "test.py", line 5, in __new__
retobj.__doinit = True
AttributeError: 'Results' object has no attribute '_Results__doinit'