Skip to content

Commit bc66913

Browse files
committed
Fix further GLE overwrite errors.
1 parent c0f73d1 commit bc66913

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

Python/pystate.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2193,7 +2193,17 @@ PyGILState_Check(void)
21932193
return 0;
21942194
}
21952195

2196-
return (tstate == gilstate_tss_get(runtime));
2196+
#ifdef MS_WINDOWS
2197+
int err = GetLastError();
2198+
#endif
2199+
2200+
PyThreadState *tcur = gilstate_tss_get(runtime);
2201+
2202+
#ifdef MS_WINDOWS
2203+
SetLastError(err);
2204+
#endif
2205+
2206+
return (tstate == tcur);
21972207
}
21982208

21992209
PyGILState_STATE

0 commit comments

Comments
 (0)