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 crash #1993

Open
realead opened this Issue Nov 11, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@realead
Contributor

realead commented Nov 11, 2017

For this code:

cdef class A:
    pass

cdef class B:
    cdef A carray[100]

the compiler crashes:

[] python --version
Python 3.6.2 :: Anaconda custom (64-bit)
[] python -m cython --version
Cython version 0.27.1
[] python -m cython array_calls.pyx 

Error compiling Cython file:
------------------------------------------------------------
...
cdef class A:
    pass

cdef class B:
    cdef A carray[100]
                ^
------------------------------------------------------------

array_calls.pyx:5:17: Array element cannot be a Python object

Error compiling Cython file:
------------------------------------------------------------
...
cdef class A:
    pass

cdef class B:
    ^
------------------------------------------------------------

array_calls.pyx:4:5: Compiler crash in AnalyseDeclarationsTransform

ModuleNode.body = StatListNode(array_calls.pyx:1:0)
StatListNode.stats[1] = CClassDefNode(array_calls.pyx:4:5,
    as_name = 'B',
    class_name = 'B',
    module_name = '',
    visibility = 'private')

Compiler crash traceback from this point on:
  File "Cython/Compiler/Visitor.py", line 180, in Cython.Compiler.Visitor.TreeVisitor._visit
  File "/home/ed/anaconda3/lib/python3.6/site-packages/Cython/Compiler/ParseTreeTransforms.py", line 1640, in visit_CClassDefNode
    self._inject_pickle_methods(node)
  File "/home/ed/anaconda3/lib/python3.6/site-packages/Cython/Compiler/ParseTreeTransforms.py", line 1705, in _inject_pickle_methods
    e.type.create_to_py_utility_code(env)
  File "/home/ed/anaconda3/lib/python3.6/site-packages/Cython/Compiler/PyrexTypes.py", line 2347, in create_to_py_utility_code
    if not self.base_type.create_to_py_utility_code(env):
AttributeError: 'PyExtensionType' object has no attribute 'create_to_py_utility_code'

@pkittenis

This comment has been minimized.

Show comment
Hide comment
@pkittenis

pkittenis Nov 13, 2017

Contributor

array_calls.pyx:5:17: Array element cannot be a Python object

Cannot create C arrays of python objects. This includes cdef classes.

Contributor

pkittenis commented Nov 13, 2017

array_calls.pyx:5:17: Array element cannot be a Python object

Cannot create C arrays of python objects. This includes cdef classes.

@realead

This comment has been minimized.

Show comment
Hide comment
@realead

realead Nov 13, 2017

Contributor

I don't say this silly code should compile, only that the compiler should not crash...

Contributor

realead commented Nov 13, 2017

I don't say this silly code should compile, only that the compiler should not crash...

@scoder

This comment has been minimized.

Show comment
Hide comment
@scoder

scoder Nov 13, 2017

Contributor

Thanks for the report. I agree that it shouldn't crash.

Contributor

scoder commented Nov 13, 2017

Thanks for the report. I agree that it shouldn't crash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment