Skip to content

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

@timfel

Description

@timfel
        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()

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions