|
61 | 61 | import com.oracle.graal.python.nodes.call.CallNode;
|
62 | 62 | import com.oracle.graal.python.nodes.call.GenericInvokeNode;
|
63 | 63 | import com.oracle.graal.python.nodes.frame.ReadCallerFrameNode;
|
| 64 | +import com.oracle.graal.python.nodes.function.FunctionRootNode; |
64 | 65 | import com.oracle.graal.python.runtime.ExecutionContext.CalleeContext;
|
65 | 66 | import com.oracle.graal.python.runtime.exception.ExceptionUtils;
|
66 | 67 | import com.oracle.graal.python.util.PythonUtils;
|
|
73 | 74 | import com.oracle.truffle.api.TruffleLanguage.Env;
|
74 | 75 | import com.oracle.truffle.api.TruffleLogger;
|
75 | 76 | import com.oracle.truffle.api.frame.VirtualFrame;
|
| 77 | +import com.oracle.truffle.api.nodes.RootNode; |
76 | 78 |
|
77 | 79 | /**
|
78 | 80 | * A handler for asynchronous actions events that need to be handled on a main thread of execution,
|
@@ -263,7 +265,14 @@ protected void perform(ThreadLocalAction.Access access) {
|
263 | 265 | // to tick again later, so we reset the gilReleaseRequested flag even
|
264 | 266 | // when the thread in question isn't actually holding it.
|
265 | 267 | gilReleaseRequested.set(false);
|
266 |
| - if (access.getLocation().getRootNode() instanceof PClosureRootNode) { |
| 268 | + RootNode rootNode = access.getLocation().getRootNode(); |
| 269 | + if (rootNode instanceof PClosureRootNode) { |
| 270 | + if (rootNode.isInternal()) { |
| 271 | + return; |
| 272 | + } |
| 273 | + if (rootNode instanceof FunctionRootNode && ((FunctionRootNode) rootNode).isPythonInternal()) { |
| 274 | + return; |
| 275 | + } |
267 | 276 | // we only release the gil in ordinary Python code nodes
|
268 | 277 | GilNode gil = GilNode.getUncached();
|
269 | 278 | if (gil.tryRelease()) {
|
|
0 commit comments