Login | Register For Free | Help
Search for: (Advanced)

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

Index | Next | Previous | View Flat


heikki at osafoundation

Jul 23, 2008, 11:42 AM


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

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.

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?

--
Heikki Toivonen
--
http://mail.python.org/mailman/listinfo/python-list

Subject User Time
Undocumented Python 2.6 change: Py_None vs NULL when C implementation raises exception heikki at osafoundation Jul 23, 2008, 11:42 AM
    Re: Undocumented Python 2.6 change: Py_None vs NULL when C implementation raises exception fredrik at pythonware Jul 23, 2008, 12:45 PM
    Re: Undocumented Python 2.6 change: Py_None vs NULL when C implementation raises exception martin at v Jul 23, 2008, 3:31 PM
        Re: Undocumented Python 2.6 change: Py_None vs NULL when C implementation raises exception heikki at osafoundation Jul 23, 2008, 10:33 PM
            Re: Undocumented Python 2.6 change: Py_None vs NULL when C implementation raises exception martin at v Jul 24, 2008, 1:21 PM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.