Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 226b1db

Browse files
committed
Added notimplemented_dealloc for better error reporting
1 parent dfc2397 commit 226b1db

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

Objects/object.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1524,12 +1524,21 @@ notimplemented_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
15241524
Py_RETURN_NOTIMPLEMENTED;
15251525
}
15261526

1527+
static void
1528+
notimplemented_dealloc(PyObject* ignore)
1529+
{
1530+
/* This should never get called, but we also don't want to SEGV if
1531+
* we accidentally decref NotImplemented out of existence.
1532+
*/
1533+
Py_FatalError("deallocating NotImplemented");
1534+
}
1535+
15271536
static PyTypeObject PyNotImplemented_Type = {
15281537
PyVarObject_HEAD_INIT(&PyType_Type, 0)
15291538
"NotImplementedType",
15301539
0,
15311540
0,
1532-
none_dealloc, /*tp_dealloc*/ /*never called*/
1541+
notimplemented_dealloc, /*tp_dealloc*/ /*never called*/
15331542
0, /*tp_print*/
15341543
0, /*tp_getattr*/
15351544
0, /*tp_setattr*/

0 commit comments

Comments
 (0)