From 829a7a2be93f5d0fb1edbc0feb104181f208efc6 Mon Sep 17 00:00:00 2001 From: Karolina Surma Date: Wed, 24 Apr 2024 09:50:32 +0200 Subject: [PATCH] _PyInterpreterState_Get() has become public in Python 3.13 Since 3.13.0a1 it has been renamed to PyInterpreterStateGet() Source: https://github.com/python/cpython/pull/106321 --- psycopg/utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/psycopg/utils.c b/psycopg/utils.c index 16be9062..1dfb87d0 100644 --- a/psycopg/utils.c +++ b/psycopg/utils.c @@ -392,7 +392,10 @@ psyco_set_error(PyObject *exc, cursorObject *curs, const char *msg) static int psyco_is_main_interp(void) { -#if PY_VERSION_HEX >= 0x03080000 +#if PY_VERSION_HEX >= 0x030d0000 + /* tested with Python 3.13.0a6 */ + return PyInterpreterState_Get() == PyInterpreterState_Main(); +#elif PY_VERSION_HEX >= 0x03080000 /* tested with Python 3.8.0a2 */ return _PyInterpreterState_Get() == PyInterpreterState_Main(); #else