Describe the bug
-
Create setup.py
from Cython.Build import cythonize
import Cython.Compiler.Options
Cython.Compiler.Options.embed_pos_in_docstring = True
from setuptools import setup
setup(
ext_modules=cythonize(
"a.pyx",
compiler_directives={'fast_getattr': True},
)
)
-
Create a.pyx
def f():
cdef int[:] b
f()
-
Run in shell
rm a.c
python setup.py build_ext --inplace
python -c "import a"
-
See
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "a.pyx", line 1, in init a
def f():
AttributeError: type object 'a.array' has no attribute '__getattr__'. Did you mean: '__setattr__'?
Expected behaviour
It runs without error
OS
Linux
Python version
3.12.6
Cython version
3.0.11
Additional context
Context: trying to use memoryview in SageMath sagemath/sage#38834
Actually fast_getattr is undocumented… but SageMath uses it.
Describe the bug
Create setup.py
Create a.pyx
Run in shell
rm a.c python setup.py build_ext --inplace python -c "import a"See
Expected behaviour
It runs without error
OS
Linux
Python version
3.12.6
Cython version
3.0.11
Additional context
Context: trying to use memoryview in SageMath sagemath/sage#38834
Actually
fast_getattris undocumented… but SageMath uses it.