mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-45061: Detect Py_DECREF(Py_True) bug (GH-28089)
Add a deallocator to the bool type to detect refcount bugs in C extensions which call Py_DECREF(Py_True) or Py_DECREF(Py_False) by mistake.
This commit is contained in:
parent
9a7ec2fcde
commit
4300352000
3 changed files with 14 additions and 7 deletions
|
@ -1560,14 +1560,11 @@ none_repr(PyObject *op)
|
|||
return PyUnicode_FromString("None");
|
||||
}
|
||||
|
||||
/* ARGUSED */
|
||||
static void _Py_NO_RETURN
|
||||
none_dealloc(PyObject* ignore)
|
||||
none_dealloc(PyObject* Py_UNUSED(ignore))
|
||||
{
|
||||
/* This should never get called, but we also don't want to SEGV if
|
||||
* we accidentally decref None out of existence.
|
||||
*/
|
||||
Py_FatalError("deallocating None");
|
||||
Py_FatalError("deallocating None likely caused by a refcount bug "
|
||||
"in a C extension");
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue