Skip to content

compiler crash for mismatch in property names #1905

@realead

Description

@realead

For this file with an obvious typo:

#crash.pyx
cdef class PyResult:
    cdef int add
    @property
    def add(self):
        return self.add
    @add.setter
    def mult(self, value): ### here we go, should be add
        self.add = value

The following crash happens:


>> python --version
Python 2.7.12
>> python -m cython --version 
Cython version 0.27.1
>> python -m cython crash.pyx
Error compiling Cython file:
------------------------------------------------------------
...
    cdef int add
    @property
    def add(self):
        return self.add
    @add.setter
    def mult(self, value):
   ^
------------------------------------------------------------

crash.pyx:7:4: Compiler crash in DecoratorTransform

ModuleNode.body = StatListNode(crash.pyx:1:5)
StatListNode.stats[0] = CClassDefNode(crash.pyx:1:5,
    as_name = u'PyResult',
    class_name = u'PyResult',
    module_name = u'',
    visibility = u'private')
CClassDefNode.body = StatListNode(crash.pyx:2:4)
StatListNode.stats[2] = DefNode(crash.pyx:7:4,
    modifiers = [...]/0,
    name = u'mult',
    num_required_args = 2,
    py_wrapper_required = True,
    reqd_kw_flags_cname = '0')

Compiler crash traceback from this point on:
  File "Cython/Compiler/Visitor.py", line 180, in Cython.Compiler.Visitor.TreeVisitor._visit
    return handler_method(obj)
  File "/usr/local/lib/python2.7/dist-packages/Cython/Compiler/ParseTreeTransforms.py", line 1388, in visit_DefNode
    assert decorator.obj.name == node.name
AssertionError: 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions