From 2d18aecd7b2f549d38a13e27b682ea4966f37bd8 Mon Sep 17 00:00:00 2001 From: Nathan Goldbaum Date: Mon, 26 Aug 2024 03:10:10 -0600 Subject: [PATCH] Add critical section API (#106) --- pythoncapi_compat.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pythoncapi_compat.h b/pythoncapi_compat.h index 4ff5c74..c0feaa2 100644 --- a/pythoncapi_compat.h +++ b/pythoncapi_compat.h @@ -1338,6 +1338,13 @@ PyDict_SetDefaultRef(PyObject *d, PyObject *key, PyObject *default_value, } #endif +#if PY_VERSION_HEX < 0x030D00B3 +# define Py_BEGIN_CRITICAL_SECTION(op) { +# define Py_END_CRITICAL_SECTION() } +# define Py_BEGIN_CRITICAL_SECTION2(a, b) { +# define Py_END_CRITICAL_SECTION2() } +#endif + #if PY_VERSION_HEX < 0x030E0000 && PY_VERSION_HEX >= 0x03060000 && !defined(PYPY_VERSION) typedef struct PyUnicodeWriter PyUnicodeWriter;