[issue5322] Python 2.6 object.__new__ argument calling autodetection faulty

Jeroen Demeyer report at bugs.python.org
Sun Dec 11 15:15:48 EST 2016


Jeroen Demeyer added the comment:

Here is more minimal breaking example. This clearly shows that this patch breaks backwards compatibility.

```
$ cat obj.pyx
cdef class OBJ(object):
    pass

$ ipython
Python 2.7.13rc1 (default, Dec 11 2016, 14:21:24) 
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: import pyximport; pyximport.install()
Out[1]: (None, <pyximport.pyximport.PyxImporter at 0x7f8e8c585910>)

In [2]: import obj

In [3]: class X(obj.OBJ, dict):
   ...:     pass
   ...: 

In [4]: X()
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-a7d4f7b89654> in <module>()
----> 1 X()

TypeError: obj.OBJ.__new__(X) is not safe, use dict.__new__()
```

----------
nosy: +jdemeyer

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


More information about the Python-bugs-list mailing list