These are chat archives for pybee/general

23rd
May 2018
Yap Boon Peng
@BPYap
May 23 13:58

@freakboy3742 So I added an attribute 'message' of type org.python.Object in types/Generator.java and I've been trying to access it in ast.py via the following code:

        self.context.load_name('<generator>')
        self.context.add_opcodes(
            JavaOpcodes.GETFIELD('org/python/types/Generator', 'message', 'Lorg/python/Object;'),
        )

after transpiled, I get the following error:

Exception in thread "main" RuntimeError: message
        at org.python.types.Generator.__next__(Generator.java:76)
        at org.Python.next(Python.java:1152)
        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:8)
        at python.Test.main(Test.py)

Am I missing something/doing something wrong here?