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

Compiler crashes when return value of 'cdef' function introduces a new fused type #3217

Open
padix-key opened this issue Oct 29, 2019 · 0 comments

Comments

@padix-key
Copy link

@padix-key padix-key commented Oct 29, 2019

When I try to compile this code:

cimport cython

import numpy as np
from ..alphabet import AlphabetError


def add(cython.numeric a, cython.numeric b):
    return _add(a, b, 10)

cdef cython.integral _add(cython.numeric a, cython.numeric b, int c):
    return a + b

I get the following crash:

Error compiling Cython file:
------------------------------------------------------------
...


def add(cython.numeric a, cython.numeric b):
    return _add(a, b, 10)

cdef cython.integral _add(cython.numeric a, cython.numeric b, int c):
    ^
------------------------------------------------------------

src/biotite/sequence/align/test.pyx:14:5: Compiler crash in AnalyseDeclarationsTransform

ModuleNode.body = StatListNode(test.pyx:5:0)
StatListNode.stats[4] = StatListNode(test.pyx:14:5)
StatListNode.stats[0] = CFuncDefNode(test.pyx:14:5,
    args = [...]/3,
    has_fused_arguments = True,
    modifiers = [...]/0,
    visibility = 'private')

Compiler crash traceback from this point on:
  File "Cython/Compiler/Visitor.py", line 180, in Cython.Compiler.Visitor.TreeVisitor._visit
  File "/home/padix/bin/conda/envs/biotite-dev/lib/python3.6/site-packages/Cython/Compiler/ParseTreeTransforms.py", line 1893, in visit_FuncDefNode
    node = self._create_fused_function(env, node)
  File "/home/padix/bin/conda/envs/biotite-dev/lib/python3.6/site-packages/Cython/Compiler/ParseTreeTransforms.py", line 1834, in _create_fused_function
    node = FusedNode.FusedCFuncDefNode(node, env)
  File "Cython/Compiler/FusedNode.py", line 61, in Cython.Compiler.FusedNode.FusedCFuncDefNode.__init__
  File "Cython/Compiler/FusedNode.py", line 144, in Cython.Compiler.FusedNode.FusedCFuncDefNode.copy_cdef
  File "/home/padix/bin/conda/envs/biotite-dev/lib/python3.6/site-packages/Cython/Compiler/PyrexTypes.py", line 2940, in specialize
    result = CFuncType(self.return_type.specialize(values),
  File "/home/padix/bin/conda/envs/biotite-dev/lib/python3.6/site-packages/Cython/Compiler/PyrexTypes.py", line 1655, in specialize
    return values[self]
KeyError: FusedType(name='integral')

I am using Cython 0.29.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.