-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
Code GenerationPython SemanticsGeneral Python (3) language semanticsGeneral Python (3) language semanticsdefect
Milestone
Description
Describe the bug + To Reproduce
# has_function.pyx
def f(x):
return x+1
Cythonize it with cythonize -if has_function.pyx, then:
>>> import has_function
>>> type(has_function.f)
<class '_cython_3_0_0a9.cython_function_or_method'>
>>> dir(_cython_3_0_0a9)
['__doc__', '__loader__', '__name__', '__package__', '__spec__', '_cython_3_0_0a9.cython_function_or_method']
>>> _cython_3_0_0a9._cython_3_0_0a9.cython_function_or_method(
... )
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module '_cython_3_0_0a9' has no attribute '_cython_3_0_0a9'
this appears to be general, but it's specifically causing issues with pickling functions in the limited API or with type-slots. I'm not completely sure why it makes a difference to those.
Expected behavior
The function name in the module should be cython_function_or_method (i.e. it shouldn't have the dotted qualname prefix)
Environment (please complete the following information):
- OS: Linux
- Python version 3.8.10
- Cython version: current master branch (3.0.9a ish)
Additional context
It's OK on 0.29.x (you need to change the example to set binding to True)
>>> dir(_cython_0_29_23)
['__doc__', '__loader__', '__name__', '__package__', '__spec__', 'cython_function_or_method']
Metadata
Metadata
Assignees
Labels
Code GenerationPython SemanticsGeneral Python (3) language semanticsGeneral Python (3) language semanticsdefect