[Cython] Fwd: Re: [cython-users] checking for "None" in nogil function

Robert Bradshaw robertwb at gmail.com
Tue May 8 08:36:02 CEST 2012


On Mon, May 7, 2012 at 9:41 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
> Greg Ewing, 08.05.2012 02:05:
>> Stefan Behnel wrote:
>>
>>> The main reason we didn't change this behaviour back then was that it would
>>> clearly break user code and we thought we could do without that. That's
>>> different from considering it "right" and "good".
>>
>> I changed the None-checking behaviour in Pyrex because I *wanted*
>> to break user code. Or rather, I didn't think it would be a
>> bad thing to make people revisit their code and think properly
>> about whether they really wanted to allow None in each case.
>
> The problem here is that it's not very likely that people specifically
> tested their code with None values, especially if they didn't carefully
> think of it already when writing it.
>
> So changing the default to make people think may not result in making them
> think before their code starts throwing exceptions somewhere in production.
> And having to revisit a large amount of code at that point may turn out to
> be rather expensive.

There's also the problem of people (including me) who wrote a lot of
code that *does* correctly handle the None case which, with this
change, would suddenly start (erroneously) throwing exceptions without
all being revisited.

- Robert


More information about the cython-devel mailing list