New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
1 participant
@BPYap
Contributor

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 join this conversation on GitHub. Already have an account? Sign in to comment