Skip to content

Commit 767c894

Browse files
committed
Improve readability and fix warning.
1 parent df720a5 commit 767c894

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Python/pystate.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3487,7 +3487,7 @@ PyInterpreterView_FromMain(void)
34873487

34883488
static const PyThreadStateToken *_no_tstate_sentinel = (const PyThreadStateToken *)&_no_tstate_sentinel;
34893489

3490-
#define NO_TSTATE_SENTINEL (_no_tstate_sentinel)
3490+
#define NO_TSTATE_SENTINEL ((PyThreadStateToken *)_no_tstate_sentinel)
34913491

34923492
PyThreadStateToken *
34933493
PyThreadState_Ensure(PyInterpreterGuard *guard)
@@ -3521,10 +3521,9 @@ PyThreadState_Ensure(PyInterpreterGuard *guard)
35213521

35223522
if (attached_tstate != NULL) {
35233523
return (PyThreadStateToken*)PyThreadState_Swap(fresh_tstate);
3524-
} else {
3525-
_PyThreadState_Attach(fresh_tstate);
35263524
}
35273525

3526+
_PyThreadState_Attach(fresh_tstate);
35283527
return NO_TSTATE_SENTINEL;
35293528
}
35303529

0 commit comments

Comments
 (0)