Skip to content
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] fused types stopped working with cimport_from_pyx=True #5795

Closed
skunkyevil opened this issue Nov 4, 2023 · 0 comments · Fixed by #5796
Closed

[BUG] fused types stopped working with cimport_from_pyx=True #5795

skunkyevil opened this issue Nov 4, 2023 · 0 comments · Fixed by #5796
Labels
Milestone

Comments

@skunkyevil
Copy link

Describe the bug

Describe the bug

Cythonization of .pyx with fused types when cimport_from_pyx=True stopped working recently.
It was working on 3.0.0b1 and it does not work now on 3.0.5. I didn't dig into when it stopped working exactly.

Here's the error:

  tree = Parsing.p_module(s, pxd, full_module_name)
Traceback (most recent call last):
  File "B:\_\setup.py", line 10, in <module>
    ext_modules=cythonize("hello.pyx"),
  File "C:\Anaconda3\envs\work_pip2\lib\site-packages\Cython\Build\Dependencies.py", line 1154, in cythonize
    cythonize_one(*args)
  File "C:\Anaconda3\envs\work_pip2\lib\site-packages\Cython\Build\Dependencies.py", line 1300, in cythonize_one
    result = compile_single(pyx_file, options, full_module_name=full_module_name)
  File "C:\Anaconda3\envs\work_pip2\lib\site-packages\Cython\Compiler\Main.py", line 615, in compile_single
    return run_pipeline(source, options, full_module_name)
  File "C:\Anaconda3\envs\work_pip2\lib\site-packages\Cython\Compiler\Main.py", line 539, in run_pipeline
    err, enddata = Pipeline.run_pipeline(pipeline, source)
  File "C:\Anaconda3\envs\work_pip2\lib\site-packages\Cython\Compiler\Pipeline.py", line 398, in run_pipeline
    data = run(phase, data)
  File "C:\Anaconda3\envs\work_pip2\lib\site-packages\Cython\Compiler\Pipeline.py", line 375, in run
    return phase(data)
  File "C:\Anaconda3\envs\work_pip2\lib\site-packages\Cython\Compiler\Pipeline.py", line 52, in generate_pyx_code_stage
    module_node.process_implementation(options, result)
  File "C:\Anaconda3\envs\work_pip2\lib\site-packages\Cython\Compiler\ModuleNode.py", line 222, in process_implementation
    self.generate_c_code(env, options, result)
  File "C:\Anaconda3\envs\work_pip2\lib\site-packages\Cython\Compiler\ModuleNode.py", line 516, in generate_c_code
    self.body.generate_function_definitions(env, code)
  File "C:\Anaconda3\envs\work_pip2\lib\site-packages\Cython\Compiler\Nodes.py", line 404, in generate_function_definitions
    stat.generate_function_definitions(env, code)
  File "Cython\\Compiler\\FusedNode.py", line 961, in Cython.Compiler.FusedNode.FusedCFuncDefNode.generate_function_definitions
AttributeError: 'DictNode' object has no attribute 'entry'

My setup.py:

from setuptools import setup
from Cython.Build import cythonize
import Cython.Compiler.Options


Cython.Compiler.Options.cimport_from_pyx = True


setup(
    name='Hello',
    ext_modules=cythonize("hello.pyx"),
)

Code to reproduce the behaviour:

ctypedef fused float_or_int:
    float
    int

cpdef function(float_or_int a):
    pass

Expected behaviour

It should get cythonized and compiled successfully as it was before

OS

Windows 10

Python version

3.9

Cython version

3.0.5

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants