Skip to content
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

Python should not unconditionally print java exceptions, and not to stdout #298

Open
timfel opened this issue Nov 24, 2022 · 0 comments
Open

Comments

@timfel
Copy link
Member

timfel commented Nov 24, 2022

        Context ctx = Context.newBuilder("python").allowAllAccess(true).build();
        try {
            ctx.eval("python", "import java; java.math.BigInteger.ONE.divide(java.math.BigInteger.ZERO)");
        } catch (Exception e) {
        }

This prints the zero division exception from Java via https://github.com/oracle/graalpython/blob/master/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/exception/TopLevelExceptionHandler.java#L217. This should be guarded by something like https://github.com/oracle/graalpython/blob/master/graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/exception/TopLevelExceptionHandler.java#L182 and then also print to getContext().getEnv().err()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant