[Cython] array->memoryview typecast causes compiler crash in AnalyseExpressionsTransform

Jakub Wilk jwilk at jwilk.net
Wed Sep 2 08:16:52 CEST 2015


In https://bugs.debian.org/793129 Dan Greene reported that trying to 
cast a pointer to a memoryview object causes a compiler crash:

$ python -c 'import cython; cython.inline("<int[:12]>NULL")'
Compiling /home/jwilk/.cython/inline/_cython_inline_ad8e8c5018441f8a5417cab08ec65d13.pyx because it changed.
[1/1] Cythonizing /home/jwilk/.cython/inline/_cython_inline_ad8e8c5018441f8a5417cab08ec65d13.pyx

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



def __invoke():
    <int[:12]>NULL
   ^
------------------------------------------------------------

.cython/inline/_cython_inline_ad8e8c5018441f8a5417cab08ec65d13.pyx:5:4: Compiler crash in AnalyseExpressionsTransform

ModuleNode.body = StatListNode(_cython_inline_ad8e8c5018441f8a5417cab08ec65d13.pyx:4:0)
StatListNode.stats[0] = DefNode(_cython_inline_ad8e8c5018441f8a5417cab08ec65d13.pyx:4:0,
    modifiers = [...]/0,
    name = u'__invoke',
    py_wrapper_required = True,
    reqd_kw_flags_cname = '0',
    used = True)
File 'Nodes.py', line 430, in analyse_expressions: StatListNode(_cython_inline_ad8e8c5018441f8a5417cab08ec65d13.pyx:5:4,
    is_terminator = True)
File 'Nodes.py', line 4741, in analyse_expressions: ExprStatNode(_cython_inline_ad8e8c5018441f8a5417cab08ec65d13.pyx:5:4)
File 'ExprNodes.py', line 460, in analyse_expressions: CythonArrayNode(_cython_inline_ad8e8c5018441f8a5417cab08ec65d13.pyx:5:4,
    is_temp = True,
    mode = 'c',
    use_managed_ref = True)
File 'ExprNodes.py', line 9567, in analyse_types: CythonArrayNode(_cython_inline_ad8e8c5018441f8a5417cab08ec65d13.pyx:5:4,
    is_temp = True,
    mode = 'c',
    use_managed_ref = True)
File 'ExprNodes.py', line 9582, in get_cython_array_type: CythonArrayNode(_cython_inline_ad8e8c5018441f8a5417cab08ec65d13.pyx:5:4,
    is_temp = True,
    mode = 'c',
    use_managed_ref = True)

Compiler crash traceback from this point on:
  File "/home/jwilk/.local/lib/python2.7/site-packages/Cython/Compiler/ExprNodes.py", line 9582, in get_cython_array_type
    return env.global_scope().context.cython_scope.viewscope.lookup("array").type
AttributeError: 'CythonScope' object has no attribute 'viewscope'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/jwilk/.local/lib/python2.7/site-packages/Cython/Shadow.py", line 114, in inline
    return cython_inline(f, *args, **kwds)
  File "/home/jwilk/.local/lib/python2.7/site-packages/Cython/Build/Inline.py", line 212, in cython_inline
    build_extension.extensions = cythonize([extension], include_path=cython_include_dirs, quiet=quiet)
  File "/home/jwilk/.local/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 877, in cythonize
    cythonize_one(*args)
  File "/home/jwilk/.local/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 997, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: /home/jwilk/.cython/inline/_cython_inline_ad8e8c5018441f8a5417cab08ec65d13.pyx

-- 
Jakub Wilk


More information about the cython-devel mailing list