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] from libcpp.vector import * #5562
Comments
Duplicate of #4931 (but thanks for the report!) This isn't to do with the I think it's really The trouble is Cython declares an extern int This really shouldn't happen for things defined in utility code and maybe should be more limited generally. For example maybe the extern variable should be declared const and thus not be replaceable.. |
Follow the lead of `Cython/Includes/cpython/pyport.pxd` to declare `PY_SSIZE_T_MIN` and `PY_SSIZE_T_MAX` as `const`. This prevents Cython from trying to override or assign to this "variable" when doing wildcard imports. Add a test that shows this behavior in one example. Fixes cython#5562
Follow the lead of `Cython/Includes/cpython/pyport.pxd` to declare `PY_SSIZE_T_MIN` and `PY_SSIZE_T_MAX` as `const`. This prevents Cython from trying to override or assign to this "variable" when doing wildcard imports. Add a test that shows this behavior in one example. Fixes cython#5562
@da-woods Thanks for your input, and thanks for the pointer to the underlying general issue. For this particular issue I found that (thanks to your input!) a more fine-grained solution does the trick: make We have an existing code base that uses |
Will reopen so we have something to link your specific fix. I think it's an improvement anyway so happy to merge it ahead of a more general fix. |
In terms of the more general fix: I think the relevant function is |
Follow the lead of `Cython/Includes/cpython/pyport.pxd` to declare `PY_SSIZE_T_MIN` and `PY_SSIZE_T_MAX` as `const`. This prevents Cython from trying to override or assign to this "variable" when doing wildcard imports. Add a test that shows this behavior in one example. Fixes cython#5562
Follow the lead of `Cython/Includes/cpython/pyport.pxd` to declare `PY_SSIZE_T_MIN` and `PY_SSIZE_T_MAX` as `const`. This prevents Cython from trying to override or assign to this "variable" when doing wildcard imports. Add a test that shows this behavior in one example. Fixes #5562
Describe the bug
The line
from libcpp.vector import *
in the testcase below leads to GCC failing to compile the test with the following error:The compile error makes sense, as Cython 3.0.0 generates the following code:
Code to reproduce the behaviour:
A runnable test showing this behavior is available in #5561 for easier reproduction.
Expected behaviour
No response
OS
Linux
Python version
3.9.16
Cython version
3.0.0
Additional context
This code (well, the code this was reduced from) worked fine in Cython 3.0a1 (way.... back then, I know). If necessary I can try to bisect this further.
The text was updated successfully, but these errors were encountered: