[issue14630] non-deterministic behavior of int subclass

Mark Dickinson report at bugs.python.org
Fri Apr 20 13:53:11 CEST 2012


Mark Dickinson <dickinsm at gmail.com> added the comment:

Self-contained example that fails for me on 32-bit OS X.




class Integer(int):
    def __new__(cls, value, base=10, indirect=False):
        try:
            obj = int.__new__(cls, value, base)
        except TypeError:
            obj = int.__new__(cls, value)
        return obj

    def __init__(self, value, base=10, indirect=False):
        self.indirect = indirect


integers = []
for i in range(1000):
    integer = Integer(b'0')
    integers.append(integer)

for integer in integers:
    assert int(integer) == 0

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14630>
_______________________________________


More information about the Python-bugs-list mailing list