On Thu, Jan 6, 2011 at 10:48 AM, Vitja Makarov <vitja.maka...@gmail.com> wrote:
> 2011/1/6 Robert Bradshaw <rober...@math.washington.edu>:
>> On Thu, Jan 6, 2011 at 10:30 AM, Stefan Behnel <stefan...@behnel.de> wrote:
>>> Daniel Norberg, 06.01.2011 12:20:
>>>> I'm getting a curious error in Cython 0.14 when trying to compile this:
>>>>
>>>>    def bar(foo):
>>>>        qux = foo
>>>>        quux = foo[qux.baz]
>>>>
>>>> The error message:
>>>>
>>>>       $ cython bar.py
>>>>
>>>>       Error compiling Cython file:
>>>>       ------------------------------------------------------------
>>>>       ...
>>>>       def bar(foo):
>>>>               qux = foo
>>>>               quux = foo[qux.baz]
>>>>                     ^
>>>>       ------------------------------------------------------------
>>>>
>>>>       /Users/daniel/Desktop/cython-test/bar.py:3:15: Object of type 
>>>> '<unspecified>' has no attribute 'baz'
>>>>
>>>> Cython 0.13 compiles this just fine. I also tried the latest revision of 
>>>> cython-devel (b816b03ff502) and it fails.
>>>
>>> I can reproduce this. From a quick test, it seems like the type inference
>>> machinery processes 'quux' and 'qux' in the wrong order, i.e. 'quux' before
>>> 'qux'. Anyone interested in taking a closer look?
>>
>> That shouldn't be happening, as it should know the inferred type of
>> quux depends on the inferred type of qux. I'll take a look.
>>
>> - Robert
>> _______________________________________________
>> Cython-dev mailing list
>> Cython-dev@codespeak.net
>> http://codespeak.net/mailman/listinfo/cython-dev
>>
>
> Strange thing this code compiles:
>
> def bar(foo):
>    qux = foo
>    xquux = foo[qux.baz]
>
> but this doesn't:
>
> def bar(foo):
>    qux = foo
>    aquux = foo[qux.baz]

Since it doesn't detect the dependency, half the time it'll get lucky
(probably as a function of the variable names).

- Robert
_______________________________________________
Cython-dev mailing list
Cython-dev@codespeak.net
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to