Amaury Forgeot d'Arc added the comment:

"Py_INCREF(v); return v;" should be used only for immutable types, not for 
subclasses. in 3.2, the code below prints "3, None":

import decimal
class MyDecimal(decimal.Decimal):
    x = None
    def __new__(cls, value):
        return super().__new__(cls, value)
        return obj
a = MyDecimal("1.1")
a.x = 3
b = MyDecimal(a)
print(a.x, b.x)

----------
nosy: +amaury.forgeotdarc

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16431>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to