Stefan Behnel, 10.01.2014 10:11: > Simon Jagoe, 09.01.2014 14:04: >>> Looking at the code in Py3, ISTM that it would be sufficient to do this iff >>> >>> (t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) != 0 >>> >>> which should be rare enough. >>> >>> Obviously requires some user side testing to see if it breaks any other >>> code... >> >> Thanks for looking at this. I am wondering if there is a reason why the >> tp_alloc can't be replaced with the PyBaseObject_Type->tp_new directly? > > I don't know. At least, it's some unnecessary overhead in almost all cases. > Not sure if that matters, there's enough costly stuff happening at this > point anyway. > > ISTM that we'd also have to fix the issue that Nils Bruin found, otherwise > we'd risk even more trouble on user side. > > http://thread.gmane.org/gmane.comp.python.cython.user/10267 > > >> My understanding is that initially, object's tp_new essentially just >> called tp_alloc as Cython does now. Later the abc feature was added >> with the abstract check happening in object's tp_new, while not changing >> previous (non-abstract class) behavior. If Cython were to use this >> instead of tp_alloc, it would be forward-compatible with future changes >> to object. > > Agreed.
Let's see what Jenkins has to say about it. https://github.com/cython/cython/commit/ddaffbe78c06e580ca0d9cd334c7a28a4de5c40b Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org https://mail.python.org/mailman/listinfo/cython-devel