[Cython] cdef class tp_new should call PyBaseObject_Type.tp_new?
simon at simonjagoe.com
Wed Jan 8 21:17:08 CET 2014
I recently posted to the cython-users list about this problem. This
email is to submita potential patch to fix the issue. The issue is as
At Enthought we are busy porting Traits
(http://github.com/enthought/traits) from C to Cython.
An issue has come up that that prevents classes inheriting from a
cdef-class from playing nicely with ABCs. It is type's tp_new that
checks for abstractmethods that have not been implemented, so if type's
tp_new is bypassed, the check is never run and you can instantiate an
abstract base class.
It is equivalent to this simple example below (taken from
http://stackoverflow.com/questions/20432335). If you replace the simple
class A with a Cython cdef class, the effect is the same.
# self = object.__new__(cls)
__metaclass__ = abc.ABCMeta
b = B() # No exception.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 989 bytes
Desc: not available
More information about the cython-devel