There was an error while loading. Please reload this page.
1 parent 29198ea commit a712679Copy full SHA for a712679
Python/ceval.c
@@ -169,8 +169,10 @@ PyEval_ThreadsInitialized(void)
169
void
170
PyEval_InitThreads(void)
171
{
172
- if (gil_created())
+ if (gil_created()) {
173
return;
174
+ }
175
+
176
PyThread_init_thread();
177
create_gil();
178
take_gil(_PyThreadState_GET());
@@ -184,10 +186,17 @@ PyEval_InitThreads(void)
184
186
185
187
_PyEval_FiniThreads(void)
188
- if (!gil_created())
189
+ if (!gil_created()) {
190
191
192
193
destroy_gil();
194
assert(!gil_created());
195
196
+ if (_PyRuntime.ceval.pending.lock != NULL) {
197
+ PyThread_free_lock(_PyRuntime.ceval.pending.lock);
198
+ _PyRuntime.ceval.pending.lock = NULL;
199
200
}
201
202
0 commit comments