diff options
author | Victor Stinner <vstinner@python.org> | 2021-09-21 21:04:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-21 21:04:34 (GMT) |
commit | 79a31480992c3fa5890fc7a6c5d9af6d337d5844 (patch) | |
tree | a3ef89bb0340669e86c52f5b924cfb0e71845956 /Python/pylifecycle.c | |
parent | f604cf1c377a7648e0686044e6e49900bfc9feef (diff) | |
download | cpython-79a31480992c3fa5890fc7a6c5d9af6d337d5844.zip cpython-79a31480992c3fa5890fc7a6c5d9af6d337d5844.tar.gz cpython-79a31480992c3fa5890fc7a6c5d9af6d337d5844.tar.bz2 |
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.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r-- | Python/pylifecycle.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index b10a19c..bfddc19 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -2806,6 +2806,16 @@ _Py_FatalErrorFormat(const char *func, const char *format, ...) void _Py_NO_RETURN +_Py_FatalRefcountErrorFunc(const char *func, const char *msg) +{ + _Py_FatalErrorFormat(func, + "%s: bug likely caused by a refcount error " + "in a C extension", + msg); +} + + +void _Py_NO_RETURN Py_ExitStatusException(PyStatus status) { if (_PyStatus_IS_EXIT(status)) { |