mirror of
https://github.com/python/cpython.git
synced 2025-10-06 23:21:06 +00:00
bpo-45061: Detect refcount bug on empty tuple singleton (GH-28503)
Detect refcount bugs in C extensions when the empty tuple singleton is destroyed by mistake. Add the _Py_FatalRefcountErrorFunc() function.
This commit is contained in:
parent
f604cf1c37
commit
79a3148099
6 changed files with 41 additions and 5 deletions
|
@ -1,6 +1,7 @@
|
|||
/* Boolean type, a subtype of int */
|
||||
|
||||
#include "Python.h"
|
||||
#include "pycore_pyerrors.h" // _Py_FatalRefcountError()
|
||||
#include "longintrepr.h"
|
||||
|
||||
/* We define bool_repr to return "False" or "True" */
|
||||
|
@ -156,8 +157,7 @@ static PyNumberMethods bool_as_number = {
|
|||
static void _Py_NO_RETURN
|
||||
bool_dealloc(PyObject* Py_UNUSED(ignore))
|
||||
{
|
||||
Py_FatalError("deallocating True or False likely caused by "
|
||||
"a refcount bug in a C extension");
|
||||
_Py_FatalRefcountError("deallocating True or False");
|
||||
}
|
||||
|
||||
/* The type object for bool. Note that this cannot be subclassed! */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue