Skip to content
This repository has been archived by the owner. It is now read-only.

RunTimeError when generator is nested in more than 1 level of function definition #866

Closed
BPYap opened this issue Jul 4, 2018 · 0 comments
Closed

Comments

@BPYap
Copy link
Contributor

@BPYap BPYap commented Jul 4, 2018

Consider Test.py:

def wrapped():
    def func():
        def gen():
            yield 'Hello World'

        print(next(gen()))

    func()
    
wrapped()

Compilation messages:

Compiling Test.py ...
Writing .\python\Test.class ...
Writing .\python\Test\func.class ...
Writing .\python\Test\func$gen.class ...

Execution outputs:

Exception in thread "main" RuntimeError: python.Test.func.gen
        at org.python.types.Function.invoke(Function.java:412)
        at org.python.types.Function.invoke(Function.java:347)
        at python.Test.func.invoke(Test.py:53)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.python.types.Function.invoke(Function.java:390)
        at org.python.types.Function.invoke(Function.java:347)
        at python.Test.wrapped(Test.py:55)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.python.types.Function.invoke(Function.java:388)
        at org.python.types.Function.invoke(Function.java:347)
        at python.Test.module$import(Test.py:57)
        at python.Test.main(Test.py)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant