Skip to content

polyglot/graalpy bind async method and call from java #12422

@kgonia

Description

@kgonia

Describe GraalVM and your environment :

  • GraalVM version: GraalVM CE 25+37.1 (build 25+37-jvmci-b01)
  • JDK version: openjdk 25 2025-09-16
  • OS and OS Version: WSL Ubuntu 22.04.4 LTS
  • Architecture: amd64
  • The output of java -Xinternalversion:
OpenJDK 64-Bit Server VM (25+37-jvmci-b01) for linux-amd64 JRE (25+37-jvmci-b01), built on 2025-09-01T11:30:30Z with gcc 14.2.0

Have you verified this issue still happens when using the latest snapshot?
No

Describe the issue
Execution of asynchronous function from python have no effect.

Code snippet or code repository that reproduces the issue

I have simple python script

import os
from typing import Optional


def print_current_path():
    print(os.getcwd())

async def print_text_async():
    print('just text')

def method_with_default_params(username: str, page_size=12, max_pages: Optional[int] = None):
    print(username)
    print(page_size)
    print(max_pages)

I bind them in Java and try to execute.

    @Override
    public void run(String... args) throws IOException {
        context.eval(Source.newBuilder("python", SpringBootConsoleApplication.class.getResource("/working_dir_print.py")).build());

        Value currentPathMethod = context.getBindings("python").getMember("print_current_path");
        currentPathMethod.execute();

        Value justText = context.getBindings("python").getMember("print_text_async");
        justText.execute();

        Value withParams = context.getBindings("python").getMember("method_with_default_params");
        withParams.execute("google", 1);
    }

after executing currentPathMethod & withParams I got results but I see no effect after executing justText. I tried to find any example in doc or other issues but still unsure if this is supported.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions