-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[BUG] cpdef module-level variables not exposed to Python #3959
Copy link
Copy link
Closed
Labels
Description
Describe the bug
For a cpdef variable declared at the module level like this
# test_cpdef_module_var.pyx
...
cpdef str abc = 'this is abc'
...I would expect that I can access this Python string in the Python space simply by test_cpdef_module_var.abc. However, this appears to be not possible, and we had to work around it by explicitly declaring a Python object referencing it:
# test_cpdef_module_var.pyx
...
cpdef str _abc = 'this is abc'
abc = _abc
...which is both counterintuitive and cumbersome. I tried searching in the issue tracker but it doesn't seem to be reported yet, and the closest report I found is this (#656) but not exactly the same, so I hope I am simply missing something obvious...
To Reproduce
See above.
Expected behavior
See above.
Environment (please complete the following information):
- OS: Linux
- Python version: 3.7.8
- Cython version: 0.29.21
Reactions are currently unavailable