Raise an error instead of crashing with a segfault when a NULL

function pointer is called.

Will backport to release25-maint.
This commit is contained in:
Thomas Heller 2008-01-11 19:34:06 +00:00
parent de68037202
commit c682614df0
2 changed files with 11 additions and 0 deletions

View file

@ -3312,6 +3312,11 @@ CFuncPtr_call(CFuncPtrObject *self, PyObject *inargs, PyObject *kwds)
pProc = *(void **)self->b_ptr;
if (pProc == NULL) {
PyErr_SetString(PyExc_ValueError,
"attempt to call NULL function pointer");
return NULL;
}
#ifdef MS_WIN32
if (self->index) {
/* It's a COM method */