Skip to content

Commit 2c2f2b4

Browse files
committed
don't run PyThread_exit_thread() when you don't have to
Code is from gh#python/cpython@83ad40e and it was released upstream in 3.9.10. Fixes: bsc#1203355 Patch: bpo-44434-libgcc_s-for-pthread_cancel.patch
1 parent 62510b7 commit 2c2f2b4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Modules/_testcapimodule.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3651,8 +3651,6 @@ temporary_c_thread(void *data)
36513651
PyGILState_Release(state);
36523652

36533653
PyThread_release_lock(test_c_thread->exit_event);
3654-
3655-
PyThread_exit_thread();
36563654
}
36573655

36583656
static PyObject *

Modules/_threadmodule.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,10 @@ t_bootstrap(void *boot_raw)
10271027
nb_threads--;
10281028
PyThreadState_Clear(tstate);
10291029
PyThreadState_DeleteCurrent();
1030-
PyThread_exit_thread();
1030+
1031+
// bpo-44434: Don't call explicitly PyThread_exit_thread(). On Linux with
1032+
// the glibc, pthread_exit() can abort the whole process if dlopen() fails
1033+
// to open the libgcc_s.so library (ex: EMFILE error).
10311034
}
10321035

10331036
static PyObject *

0 commit comments

Comments
 (0)