Skip to content

Commit 12b7053

Browse files
committed
Use appropriate getter for native thread state
1 parent 24dc3b4 commit 12b7053

File tree

1 file changed

+4
-6
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/common

1 file changed

+4
-6
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/common/CExtCommonNodes.java

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,9 @@ static void setCurrentException(Frame frame, Node inliningTarget, PException e,
495495
* 'getUnreifiedException'. As soon as we provide the exception object and the traceback
496496
* as well, we need to use 'getEscapedException'.
497497
*/
498-
PThreadState nativeWrapper = threadState.getNativeWrapper();
499-
if (nativeWrapper != null) {
498+
Object nativeThreadState = PThreadState.getNativeThreadState(threadState);
499+
if (nativeThreadState != null) {
500500
Object exceptionType = getClassNode.execute(inliningTarget, e.getUnreifiedException());
501-
Object nativeThreadState = PThreadState.getOrCreateNativeThreadState(threadState);
502501
/*
503502
* Write a borrowed ref to the native mirror because we need to keep that in sync
504503
* anyway.
@@ -1272,9 +1271,8 @@ public final PException getCurrentExceptionForReraise(Node inliningTarget, Pytho
12721271
static void doGeneric(PythonThreadState threadState,
12731272
@Cached(inline = false) CStructAccess.WritePointerNode writePointerNode) {
12741273
threadState.clearCurrentException();
1275-
PThreadState nativeWrapper = threadState.getNativeWrapper();
1276-
if (nativeWrapper != null) {
1277-
Object nativeThreadState = PThreadState.getOrCreateNativeThreadState(threadState);
1274+
Object nativeThreadState = PThreadState.getNativeThreadState(threadState);
1275+
if (nativeThreadState != null) {
12781276
writePointerNode.write(nativeThreadState, CFields.PyThreadState__curexc_type, 0L);
12791277
}
12801278
}

0 commit comments

Comments
 (0)