Skip to content

Regression in 0.27.1 #1908

@stefanmh

Description

@stefanmh

The following testcase:

a.pxd

import cython
from cpython cimport array

cdef class A:
	@cython.locals(x='double[:]')
	cpdef f(self)

a.py

import array

class A():
	def f(self):
		a = array.array('d', [0.0])

Works in 0.27.0

$ pip install -U cython==0.27.0
$ rm a.c; cython a.py
$

Fails in 0.27.1

$ pip install -U cython==0.27.1
$ rm a.c; cython a.py

Error compiling Cython file:
------------------------------------------------------------
...
import cython
from cpython cimport array

cdef class A:
        @cython.locals(x='double[:]')
                 ^
------------------------------------------------------------

a.pxd:5:18: Compiler crash in AnalyseDeclarationsTransform

ModuleNode.body = StatListNode(a.py:1:0)
StatListNode.stats[1] = StatListNode(a.py:3:0)
StatListNode.stats[0] = CClassDefNode(a.py:3:0,
    class_name = u'A',
    visibility = 'private')
CClassDefNode.body = StatListNode(a.py:4:1)
StatListNode.stats[0] = CFuncDefNode(a.py:4:1,
    args = [...]/1,
    is_c_class_method = 1,
    modifiers = [...]/0,
    overridable = 1,
    visibility = 'private')
File 'ExprNodes.py', line 1589, in analyse_as_type: StringNode(a.pxd:5:18,
    is_literal = 1,
    is_string_literal = True,
    result_is_used = True,
    unicode_value = u'double[:]',
    use_managed_ref = True,
    value = 'double[:]')

Compiler crash traceback from this point on:
  File "***/Cython/Compiler/ExprNodes.py", line 1589, in analyse_as_type
    return _analyse_name_as_type(self.unicode_value or self.value.decode('ISO8859-1'), self.pos, env)
  File "***/Cython/Compiler/ExprNodes.py", line 1375, in _analyse_name_as_type
    return sizeof_node.arg_type.analyse_types(env)
AttributeError: 'NoneType' object has no attribute 'analyse_types'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions