[Cython] Compiler crash fix

mark florisson markflorisson88 at gmail.com
Wed May 22 11:48:47 CEST 2013


On 22 May 2013 10:13, Nikita Nemkin <nikita at nemkin.ru> wrote:
> 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
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> http://mail.python.org/mailman/listinfo/cython-devel

Pull requests are useful not just for large patches, but for small
ones since they serve as documentation, assign credit to the right
person, and allow the merger to observe the travis-ci results. The
ease with which things can be merged contribute largely to it getting
merged.


More information about the cython-devel mailing list