It seems that Pyrex has some nasty bugs here. Most obviously, it fails
to cancel the exception when handling it. But even then, there's a
code-generation bug around returning in an `except' block which leads to
a null-pointer dereference.
These are Debian #875284 and #875285.
object PyLong_FromUnsignedLong(unsigned long i)
char *PyString_AS_STRING(string)
int _PyString_Resize(PyObject **string, int size) except -1
+ void PyErr_Clear()
void Py_INCREF(PyObject *obj)
void Py_DECREF(PyObject *obj)
cdef int _getfd(object fdobj):
try:
- return fdobj
+ fd = int(fdobj)
except TypeError:
- return fdobj.fileno()
+ PyErr_Clear()
+ fd = fdobj.fileno()
+ return fd
cdef object _checkcallable(f, what):
if f is not None and not callable(f):