RunTimeError when generator is nested in more than 1 level of function definition
BPYap opened this issue · comments
Yap Boon Peng commented
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)