|
42 | 42 |
|
43 | 43 | import static com.oracle.graal.python.builtins.objects.thread.AbstractPythonLock.TIMEOUT_MAX;
|
44 | 44 |
|
| 45 | +import java.io.PrintWriter; |
45 | 46 | import java.lang.ref.WeakReference;
|
46 | 47 | import java.util.List;
|
47 | 48 |
|
|
51 | 52 | import com.oracle.graal.python.builtins.PythonBuiltinClassType;
|
52 | 53 | import com.oracle.graal.python.builtins.PythonBuiltins;
|
53 | 54 | import com.oracle.graal.python.builtins.objects.PNone;
|
| 55 | +import com.oracle.graal.python.builtins.objects.exception.PBaseException; |
54 | 56 | import com.oracle.graal.python.builtins.objects.function.PKeyword;
|
55 | 57 | import com.oracle.graal.python.builtins.objects.thread.PLock;
|
56 | 58 | import com.oracle.graal.python.builtins.objects.thread.PRLock;
|
57 | 59 | import com.oracle.graal.python.builtins.objects.thread.PThread;
|
58 | 60 | import com.oracle.graal.python.builtins.objects.thread.PThreadLocal;
|
59 | 61 | import com.oracle.graal.python.nodes.ErrorMessages;
|
60 |
| -import com.oracle.graal.python.nodes.WriteUnraisableNode; |
61 | 62 | import com.oracle.graal.python.nodes.argument.keywords.ExpandKeywordStarargsNode;
|
62 | 63 | import com.oracle.graal.python.nodes.argument.positional.ExecutePositionalStarargsNode;
|
63 | 64 | import com.oracle.graal.python.nodes.call.CallNode;
|
@@ -204,14 +205,24 @@ long start(VirtualFrame frame, Object cls, Object callable, Object args, Object
|
204 | 205 | } catch (PythonThreadKillException e) {
|
205 | 206 | return;
|
206 | 207 | } catch (PException e) {
|
207 |
| - WriteUnraisableNode.getUncached().execute(e.getUnreifiedException(), "in thread started by", callable); |
| 208 | + dumpError(context, e.getUnreifiedException(), callable); |
| 209 | + // TODO (cbasca): when GR-30386 is completed use the intrinsified |
| 210 | + // sys.unraisablehook |
| 211 | + // WriteUnraisableNode.getUncached().execute(e.getUnreifiedException(), "in |
| 212 | + // thread started by", callable); |
208 | 213 | }
|
209 | 214 | }, env.getContext(), context.getThreadGroup());
|
210 | 215 |
|
211 | 216 | PThread pThread = factory().createPythonThread(cls, thread);
|
212 | 217 | pThread.start();
|
213 | 218 | return pThread.getId();
|
214 | 219 | }
|
| 220 | + |
| 221 | + @TruffleBoundary |
| 222 | + static void dumpError(PythonContext context, PBaseException exception, Object object) { |
| 223 | + PrintWriter err = new PrintWriter(context.getStandardErr()); |
| 224 | + err.println(String.format("%s in thread started by %s", exception.toString(), object)); |
| 225 | + } |
215 | 226 | }
|
216 | 227 |
|
217 | 228 | @Builtin(name = "_set_sentinel", minNumOfPositionalArgs = 0)
|
|
0 commit comments