Skip to content

Commit 10a60c5

Browse files
committed
Re-acquire GIL in TopLevelExceptionHandler and removed logging messages
1 parent 1ff5f2e commit 10a60c5

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/nodes/control/TopLevelExceptionHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ public Object execute(VirtualFrame frame) {
136136
assert !PArguments.isPythonFrame(frame);
137137
throw handlePythonException(e.getEscapedException());
138138
} catch (StackOverflowError e) {
139+
getContext().recoverFromSoe(e);
139140
PBaseException newException = PythonObjectFactory.getUncached().createBaseException(RecursionError, "maximum recursion depth exceeded", new Object[]{});
140141
PException pe = ExceptionHandlingStatementNode.wrapJavaException(e, this, newException);
141142
throw handlePythonException(pe.getEscapedException());

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PythonContext.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,14 +1237,12 @@ public PythonNativeWrapper getSingletonNativeWrapper(PythonAbstractObject obj) {
12371237

12381238
public void recoverFromSoe(Throwable e) {
12391239
if (!ownsGil()) {
1240-
System.out.println("SOE thrown and we don't have GIL");
1241-
e.printStackTrace(System.out);
12421240
while (true) {
12431241
try {
12441242
acquireGil();
12451243
return;
1246-
} catch (InterruptedException ee) {
1247-
System.out.println("INTERRUPTED");
1244+
} catch (InterruptedException ignored) {
1245+
// just keep trying
12481246
}
12491247
}
12501248
}

0 commit comments

Comments
 (0)