Commit 5c6cf78b authored by da-woods's avatar da-woods Committed by GitHub

Disable CYTHON_FAST_PYCALL on Py3.10 (0.29.x) (GH-4735)

It causes issues while profiling or debugging where global variables can end up inadvertently changed.

Fixes https://github.com/cython/cython/issues/4609
parent 35ab4907
......@@ -192,7 +192,8 @@
#ifndef CYTHON_FAST_PYCALL
// Python 3.11 deleted localplus argument from frame object, which is used in our
// fast_pycall code
#define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1)
// On Python 3.10 it causes issues when used while profiling/debugging
#define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030A0000)
#endif
#ifndef CYTHON_PEP489_MULTI_PHASE_INIT
#define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000)
......
PYTHON setup.py build_ext -i
PYTHON run.py
######## setup.py ########
from Cython.Build.Dependencies import cythonize
from distutils.core import setup
setup(
ext_modules = cythonize("*.pyx"),
)
####### call_func.pyx ##########
import mod
def cy_method(x):
return mod.function(x)
####### mod.py #################
mod_global = "this is a mod global"
def function(a, mod_global=None):
if mod_global is not None:
mod_global = a
return
####### run.py #################
from call_func import cy_method
import mod
import sys
def trace(frame, event, arg):
assert(mod.mod_global == "this is a mod global")
return trace
sys.settrace(trace)
cy_method("s")
assert(mod.mod_global == "this is a mod global")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment