From dacb26cec739a2afa2ba9d305f05504168612bf8 Mon Sep 17 00:00:00 2001 From: scoder Date: Fri, 31 Mar 2023 20:00:12 +0200 Subject: Avoid deprecated Py_OptimizeFlag in Py3.12 (GH-5343) * Work around the deprecation of Py_OptimizeFlag in Py3.12 by reading the value from the interpreter's current PyConfig. See https://github.com/python/cpython/issues/99872 * Avoid access to PyConfig without holding the GIL when trying to read the old Py_OptimizeFlag. The flag was never meant to be modifiable and thus can be read once at module import time. See https://github.com/python/cpython/issues/99872#issuecomment-1333763465 --- Cython/Utility/ModuleSetupCode.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'Cython/Utility/ModuleSetupCode.c') diff --git a/Cython/Utility/ModuleSetupCode.c b/Cython/Utility/ModuleSetupCode.c index 950d89a67..f85370f44 100644 --- a/Cython/Utility/ModuleSetupCode.c +++ b/Cython/Utility/ModuleSetupCode.c @@ -613,10 +613,6 @@ class __Pyx_FakeReference { /////////////// PythonCompatibility /////////////// -#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) - #define Py_OptimizeFlag 0 -#endif - #define __PYX_BUILD_PY_SSIZE_T "n" #define CYTHON_FORMAT_SSIZE_T "z" -- cgit v1.2.1