aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Include/internal/pycore_pyerrors.h
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-09-21 23:04:34 +0200
committerGitHub <noreply@github.com>2021-09-21 23:04:34 +0200
commit79a31480992c3fa5890fc7a6c5d9af6d337d5844 (patch)
treea3ef89bb0340669e86c52f5b924cfb0e71845956 /Include/internal/pycore_pyerrors.h
parentf604cf1c377a7648e0686044e6e49900bfc9feef (diff)
downloadcpython-79a31480992c3fa5890fc7a6c5d9af6d337d5844.tar.gz
cpython-79a31480992c3fa5890fc7a6c5d9af6d337d5844.zip
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 'Include/internal/pycore_pyerrors.h')
-rw-r--r--Include/internal/pycore_pyerrors.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/Include/internal/pycore_pyerrors.h b/Include/internal/pycore_pyerrors.h
index a5e97fe23fb..0f4d41c7e0b 100644
--- a/Include/internal/pycore_pyerrors.h
+++ b/Include/internal/pycore_pyerrors.h
@@ -90,6 +90,12 @@ extern PyObject* _Py_Offer_Suggestions(PyObject* exception);
PyAPI_FUNC(Py_ssize_t) _Py_UTF8_Edit_Cost(PyObject *str_a, PyObject *str_b,
Py_ssize_t max_cost);
+PyAPI_FUNC(void) _Py_NO_RETURN _Py_FatalRefcountErrorFunc(
+ const char *func,
+ const char *message);
+
+#define _Py_FatalRefcountError(message) _Py_FatalRefcountErrorFunc(__func__, message)
+
#ifdef __cplusplus
}
#endif