Am 22.05.2013 11:48, schrieb mark florisson:
> On 22 May 2013 10:13, Nikita Nemkin wrote:
>> 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.
> 
> 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.

All of the above, plus: once there's a test associated with a bug fix,
the patch usually stops looking "too short to merit a pull request". And
tests are the only way to make sure that bugs don't come back, i.e. that
the patch is not wasted in the long run.

Stefan

_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to