[Cython] Compiler crash fix
Nikita Nemkin
nikita at nemkin.ru
Wed May 22 11:13:02 CEST 2013
Hi,
Someone please apply this patch (too simple for pull request):
diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py
index 0406fad..640d002 100755
--- a/Cython/Compiler/ExprNodes.py
+++ b/Cython/Compiler/ExprNodes.py
@@ -4993,7 +4993,7 @@ class AttributeNode(ExprNode):
# creates a corresponding NameNode and returns it, otherwise
# returns None.
type = self.obj.analyse_as_extension_type(env)
- if type:
+ if type and type.scope:
entry = type.scope.lookup_here(self.attribute)
if entry and entry.is_cmethod:
if type.is_builtin_type:
It fixes CompilerCrash (None does not have "lookup_here" method)
that I have observed on two occasions:
1) cdef class Name; cimport Name; Name.attr
2) from X cimport Name; Name.attr # cimport_from_pyx is active, Name is a
class with errors
Makes me wonder if ErrorScope should be introduced to avoid None scope
checks.
Best regards,
Nikita Nemkin
More information about the cython-devel
mailing list