summaryrefslogtreecommitdiffstats
path: root/Objects/object.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-08-31 16:05:15 (GMT)
committerGitHub <noreply@github.com>2021-08-31 16:05:15 (GMT)
commit4300352000beed22fb525ec45fd331918d206528 (patch)
treed85e14e3f00ce829258f890ee2e71698c9adf713 /Objects/object.c
parent9a7ec2fcdee2da9e080ca459d4c240776df72567 (diff)
downloadcpython-4300352000beed22fb525ec45fd331918d206528.zip
cpython-4300352000beed22fb525ec45fd331918d206528.tar.gz
cpython-4300352000beed22fb525ec45fd331918d206528.tar.bz2
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.
Diffstat (limited to 'Objects/object.c')
-rw-r--r--Objects/object.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Objects/object.c b/Objects/object.c
index 446c974..026262b 100644
--- a/Objects/object.c
+++ b/Objects/object.c
@@ -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 *