New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Bad interaction with tracing and calling back into Python #4609
Comments
To be clear, for all I know this is a problem in |
Hmmm, nevermind... I think I forgot to delete the build folder and the sources were not regenerated. Cython 3 alpha seems to fix this issue, so I guess it was a known issue about frame changes in Python. |
We just had a report in NumPy running into this issue. Considering that this only affects debugging/profiling, I am not sure how pressing it is, though (i.e. the question is a bit if few reports currently are also because 3.10 isn't pervasive yet). I am wondering if there is a simple solution to push? A backport of the fix, or the 3.0 release (so that numpy/pandas can do a bugfix release using that?). |
The relevant commit that fixes it looks to be 4fb1e7a. That's a fairly substantial change that I think we deliberately didn't backport. Defining the cflag |
It causes issues while profiling or debugging where global variabels can end up inadvertently changed. Fixes cython#4609
It causes issues while profiling or debugging where global variabels can end up inadvertently changed. Fixes cython#4609
It causes issues while profiling or debugging where global variables can end up inadvertently changed. Fixes cython#4609
Forwarding from the Pandas bug: pandas-dev/pandas#41935 (and I had also opened a Python one, but right now cython seems a more likely candidate): https://bugs.python.org/issue46451
There is an issue that calling back into Python from a Cython function can mutate module globals if the module global is a default argument (possibly not only then) and tracing is enabled and this is running on Python 3.10 (I think I confirmed for Cython 3.0 alpha as well). The repro is as easy as:
with
mod.py
:I have a functioning reproducer at: https://github.com/seberg/bpo46451 importing
bpo46451
will run the function and tracing will start printingNone
instead of the correct"this is a mod global"
.I suspect this happens here: https://github.com/cython/cython/blob/master/Cython/Utility/ObjectHandling.c#L2569-L2611
The text was updated successfully, but these errors were encountered: