Skip to content

Commit 4c892dc

Browse files
committed
[GR-47875] Avoid printing exceptions to System.err
PullRequest: graalpython/2910
2 parents 3b18909 + 3f23714 commit 4c892dc

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/PythonAbstractObject.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -530,12 +530,6 @@ public Object execute(Object[] arguments,
530530
boolean mustRelease = gil.acquire();
531531
try {
532532
return executeNode.execute(this, arguments);
533-
} catch (PException e) {
534-
throw e;
535-
} catch (Throwable e) {
536-
CompilerDirectives.transferToInterpreter();
537-
e.printStackTrace();
538-
throw e;
539533
} finally {
540534
gil.release(mustRelease);
541535
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/CApiContext.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import static com.oracle.graal.python.nodes.StringLiterals.J_NFI_LANGUAGE;
4747

4848
import java.io.IOException;
49+
import java.io.PrintStream;
4950
import java.util.ArrayList;
5051
import java.util.Arrays;
5152
import java.util.HashMap;
@@ -674,7 +675,8 @@ Object execute(Object[] arguments) {
674675
LOGGER.finer("CApiContext.GetBuiltin " + id + " / " + builtin.name());
675676
return builtin;
676677
} catch (Throwable e) {
677-
e.printStackTrace();
678+
// this is a fatal error, so print it to stderr:
679+
e.printStackTrace(new PrintStream(PythonContext.get(null).getEnv().err()));
678680
throw new RuntimeException(e);
679681
}
680682
}

0 commit comments

Comments
 (0)