[issue5322] Python 2.6 object.__new__ argument calling autodetection faulty
Tobias Hansen
report at bugs.python.org
Sat Dec 10 08:51:17 EST 2016
Tobias Hansen added the comment:
This change breaks backward compatibility in Python 2.7. This is the example that also broke in #25731. In that case the change was reverted. See https://bugs.python.org/issue25731#msg262922
$ cat foo.pxd
cdef class B:
cdef object b
$ cat foo.pyx
cdef class A:
pass
cdef class B:
def __init__(self, b):
self.b = b
$ cat bar.py
from foo import A, B
class C(A, B):
def __init__(self):
B.__init__(self, 1)
C()
$ cython foo.pyx && gcc -I/usr/include/python2.7 -Wall -shared -fPIC -o foo.so foo.c
$ python -c 'import bar'
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "bar.py", line 7, in <module>
C()
TypeError: foo.A.__new__(C) is not safe, use foo.B.__new__()
----------
nosy: +thansen
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5322>
_______________________________________
More information about the Python-bugs-list
mailing list