diff options
author | Victor Stinner <vstinner@python.org> | 2021-08-31 16:05:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-31 16:05:15 (GMT) |
commit | 4300352000beed22fb525ec45fd331918d206528 (patch) | |
tree | d85e14e3f00ce829258f890ee2e71698c9adf713 /Objects/object.c | |
parent | 9a7ec2fcdee2da9e080ca459d4c240776df72567 (diff) | |
download | cpython-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.c | 9 |
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 * |