[Cython] Compiler crash in RemoveUnreachableCode
Stefan Behnel
stefan_ml at behnel.de
Mon Jan 20 21:19:07 CET 2014
Hi,
thanks for the report, I can reproduce this.
Andriy Kornatskyy, 19.01.2014 21:00:
> The cython compiler crash report below. Steps to reproduce:
>
> 1. virtualenv env
> 2. env/bin/easy_install cython
> 3. env/bin/easy_install wheezy.http
>
> The wheezy.http has dependency on wheezy.core. If I install those two packages separately there is no error, only if through dependencies.
Yes, that's rather surprising.
> File "Visitor.py", line 178, in Cython.Compiler.Visitor.TreeVisitor._visit (/var/folders/g8/2kym1h8n7qbgrwg4qkfqw1gw0000gn/T/easy_install-JVXbGE/Cython-0.20/Cython/Compiler/Visitor.c:4437)
> File "Visitor.py", line 137, in Cython.Compiler.Visitor.TreeVisitor._raise_compiler_error (/var/folders/g8/2kym1h8n7qbgrwg4qkfqw1gw0000gn/T/easy_install-JVXbGE/Cython-0.20/Cython/Compiler/Visitor.c:3655)
> Cython.Compiler.Errors.CompilerCrash:
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
>
> """
> """
>
> __version__ = '0.1.129'
> ^
> ------------------------------------------------------------
>
> src/wheezy/core/__init__.py:5:14: Compiler crash in RemoveUnreachableCode
>
> ModuleNode.body = StatListNode(__init__.py:5:14)
>
> Compiler crash traceback from this point on:
> File "Visitor.py", line 170, in Cython.Compiler.Visitor.TreeVisitor._visit (/var/folders/g8/2kym1h8n7qbgrwg4qkfqw1gw0000gn/T/easy_install-JVXbGE/Cython-0.20/Cython/Compiler/Visitor.c:4275)
> File “/.../env/lib/python2.7/site-packages/Cython-0.20-py2.7-macosx-10.9-x86_64.egg/Cython/Compiler/ParseTreeTransforms.py", line 2135, in visit_StatListNode
> if not self.current_directives['remove_unreachable']:
> TypeError: 'NoneType' object has no attribute '__getitem__'
I only get this when Cython is compiled. When I run it from the source
tree, it works.
Debugging into Visitor.py's CythonTransform shows that this check fails:
if isinstance(node, ModuleNode.ModuleNode):
self.current_directives = node.directives
"node" actually *is* an instance of ModuleNode, just not of *that* ModuleNode.
My guess is that there's something wrong with the import mechanism that
leads to the module being imported twice. Relative versus absolute imports,
most likely. I also see a couple of weird modules in sys.modules, e.g.
"Cython.Compiler.re", so there are some more bits going generally wrong here.
I also tried it in Py3, but that even gives me a hard crash. Not really better.
I might be able to take a deeper look this weekend, but wouldn't mind if
others beat me to it.
Stefan
More information about the cython-devel
mailing list