Undocumented Python 2.6 change: Py_None vs NULL when C implementation raises exception

"Martin v. Löwis" martin at v.loewis.de
Wed Jul 23 18:31:21 EDT 2008


Heikki Toivonen wrote:
> I was debugging M2Crypto function written in C which changed behavior
> between Python 2.6 and earlier Python versions. In an error condition
> the function was supposed to raise exception type A, but with 2.6 it
> raised type B, and further, there was no string value for the exception.
>
> I tracked this down to the C code incorrectly returning Py_None when it
> should have returned NULL. Changing the C code to return NULL made it
> behave correctly in 2.6.

Can you please be specific what function you are talking about?

> I don't know how common a mistake it is to return Py_None when NULL
> should have been returned, but it might be worth a note in the list of
> changes for 2.6 that this behavior changed, don't you think?

Perhaps. OTOH, perhaps the change is completely erroneous. In that case,
rather than documenting it, it should be reverted.

Unfortunately, as you keep the specific issue secret, none of this will
happen, as we have no clue what you are talking about.

I'm sure there are tons of silent changes, in this release, all past
releases, and all future releases, not only in Python, but in any
software.

Regards,
Martin



More information about the Python-list mailing list