2012/1/25 mark florisson <[email protected]>:
> I just noticed the inline defnode call code. When I try to compile
> with 'cython -Xoptimize.inline_defnode_calls=True test.pyx' with the
> following code:
>
> def foo(x): print foo
> foo(10)
>
> I get
>
> Error compiling Cython file:
> ------------------------------------------------------------
> ...
> def foo(x):
>    print x
>
> foo(10)
>  ^
> ------------------------------------------------------------
>
> test.pyx:4:3: Compiler crash in InlineDefNodeCalls
>
> ModuleNode.body = StatListNode(test.pyx:1:0)
> StatListNode.stats[2] = ExprStatNode(test.pyx:4:3)
> ExprStatNode.expr = SimpleCallNode(test.pyx:4:3,
>    result_is_used = True,
>    use_managed_ref = True)
>
> Compiler crash traceback from this point on:
>  File "/Users/mark/cy/Cython/Compiler/Visitor.py", line 176, in _visitchild
>    result = handler_method(child)
>  File "/Users/mark/cy/Cython/Compiler/Optimize.py", line 1656, in
> visit_SimpleCallNode
>    if not function_name.cf_state.is_single:
> AttributeError: 'NoneType' object has no attribute 'is_single'


Thanks for the report! The feature is still experimental and by
default is disabled.
Anyway it wouldn't work for your example. It works when we know what
exactly function is referred by the name so it's closure case:

def foo():
    def bar():
        pass
    bar()

-- 
vitja.
_______________________________________________
cython-devel mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to