[Cython] tp_alloc() vs. object.__new__() (was: Cython 0.20 beta 2)

Robert Bradshaw robertwb at gmail.com
Sun Jan 12 10:32:47 CET 2014


On Sun, Jan 12, 2014 at 1:21 AM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Stefan Behnel, 12.01.2014 09:20:
>> The only thing that is still a bit unclear to me is whether calling
>> object.__new__() from extension types was a good idea:
>>
>> https://github.com/cython/cython/commit/ddaffbe78c06e580ca0d9cd334c7a28a4de5c40b
>>
>> It means that we are now running a couple of safety checks inside of
>> CPython on object instantiation that validate the arguments being passed
>> into __init__() and __new__(), because object() doesn't expect any.
>>
>> http://thread.gmane.org/gmane.comp.python.cython.user/10267/focus=10519
>>
>> If we want to play safe for the release, we could restrict this change only
>> to abstract classes for now (for which we know that CPython will generate
>> an error). That was the original intention of the change anyway.
>
> Proposed patch push to master for testing.
>
> https://github.com/cython/cython/commit/1a56a04bfe1b8460ecf3886c3de9268cb5e0c93a

Yeah, that might be a bit safer.

FWIW, I did see that you rolled back the earlier code in this area to
get Sage passing again (and also hooked up Jenkins to the latest
(git-based) release of Sage), and all looked good there.

- Robert


More information about the cython-devel mailing list