oracle / graalpython

A Python 3 implementation built on GraalVM
Other
1.17k stars 101 forks source link

Embedding graalpy in Java: `getMetaParents` seems to not be implemented #401

Closed jb3rndt closed 2 weeks ago

jb3rndt commented 4 weeks ago

Hello everyone,

when I use python embedded in a Java application, I tried iterating through the inheritance hierarchy of the evaluation result. I tried using getMetaParents but hasMetaParents is false and getMetaParents therefore throws an error.

Example code:

try (Context context = Context.create()) {
    Value value = context.eval("python", """
class A:
    pass

class B(A):
    pass

B()
    """);
    System.out.println(value.getMetaObject().hasMetaParents()); // prints false
}

GraalVM version: graalvm-jdk-21.0.3+7.1 Embedded python/polyglot version: 24.0.1