|
40 | 40 | */ |
41 | 41 | package com.oracle.graal.python.nodes.exception; |
42 | 42 |
|
43 | | -import static com.oracle.graal.python.builtins.PythonBuiltinClassType.RecursionError; |
44 | 43 | import static com.oracle.graal.python.builtins.modules.io.IONodes.T_WRITE; |
45 | 44 | import static com.oracle.graal.python.nodes.BuiltinNames.T_SYS; |
46 | 45 | import static com.oracle.graal.python.runtime.exception.ExceptionUtils.printToStdErr; |
|
58 | 57 | import com.oracle.graal.python.lib.PyObjectCallMethodObjArgs; |
59 | 58 | import com.oracle.graal.python.lib.PyObjectStrAsObjectNode; |
60 | 59 | import com.oracle.graal.python.nodes.BuiltinNames; |
61 | | -import com.oracle.graal.python.nodes.ErrorMessages; |
62 | 60 | import com.oracle.graal.python.nodes.bytecode.PBytecodeRootNode; |
63 | 61 | import com.oracle.graal.python.nodes.object.BuiltinClassProfiles.IsBuiltinClassProfile; |
64 | 62 | import com.oracle.graal.python.nodes.object.GetClassNode; |
|
73 | 71 | import com.oracle.graal.python.runtime.exception.ExceptionUtils; |
74 | 72 | import com.oracle.graal.python.runtime.exception.PException; |
75 | 73 | import com.oracle.graal.python.runtime.exception.PythonExitException; |
| 74 | +import com.oracle.graal.python.runtime.object.PythonObjectFactory; |
76 | 75 | import com.oracle.graal.python.util.PythonUtils; |
77 | 76 | import com.oracle.truffle.api.CompilerDirectives; |
78 | 77 | import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; |
@@ -151,13 +150,6 @@ public Object execute(VirtualFrame frame) { |
151 | 150 | return handleChildContextExit(managedException); |
152 | 151 | } |
153 | 152 | throw handlePythonException(e); |
154 | | - } catch (StackOverflowError e) { |
155 | | - CompilerDirectives.transferToInterpreter(); |
156 | | - PythonContext context = getContext(); |
157 | | - context.reacquireGilAfterStackOverflow(); |
158 | | - PBaseException newException = context.factory().createBaseException(RecursionError, ErrorMessages.MAXIMUM_RECURSION_DEPTH_EXCEEDED, new Object[]{}); |
159 | | - PException pe = ExceptionUtils.wrapJavaException(e, this, newException); |
160 | | - throw handlePythonException(pe); |
161 | 153 | } catch (ThreadDeath e) { |
162 | 154 | // do not handle, result of TruffleContext.closeCancelled() |
163 | 155 | throw e; |
@@ -218,6 +210,10 @@ private static boolean isSystemExit(PBaseException pythonException) { |
218 | 210 |
|
219 | 211 | @TruffleBoundary |
220 | 212 | private void handleJavaException(Throwable e) { |
| 213 | + PException pe = ExceptionUtils.wrapJavaExceptionIfApplicable(this, e, PythonObjectFactory.getUncached()); |
| 214 | + if (pe != null) { |
| 215 | + throw handlePythonException(pe); |
| 216 | + } |
221 | 217 | try { |
222 | 218 | boolean exitException = InteropLibrary.getUncached().isException(e) && InteropLibrary.getUncached().getExceptionType(e) == ExceptionType.EXIT; |
223 | 219 | if (!exitException) { |
|
0 commit comments