]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-104690 Disallow thread creation and fork at interpreter finalization (#104826)
authorchgnrdv <52372310+chgnrdv@users.noreply.github.com>
Sun, 4 Jun 2023 04:06:45 +0000 (07:06 +0300)
committerGitHub <noreply@github.com>
Sun, 4 Jun 2023 04:06:45 +0000 (04:06 +0000)
commitce558e69d4087dd3653207de78345fbb8a2c7835
treea96a5b705ac12fced6d95ca55787d270550edbf8
parenteaff9c39aa1a70d401521847cc35bec883ae9772
gh-104690 Disallow thread creation and fork at interpreter finalization (#104826)

Disallow thread creation and fork at interpreter finalization.

in the following functions, check if interpreter is finalizing and raise `RuntimeError` with appropriate message:
* `_thread.start_new_thread` and thus `threading`
* `posix.fork`
* `posix.fork1`
* `posix.forkpty`
* `_posixsubprocess.fork_exec` when a `preexec_fn=` is supplied.

---------

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
Co-authored-by: Gregory P. Smith <greg@krypto.org>
Doc/library/atexit.rst
Lib/test/test_os.py
Lib/test/test_subprocess.py
Lib/test/test_threading.py
Misc/NEWS.d/next/Core and Builtins/2023-05-24-12-10-54.gh-issue-104690.HX3Jou.rst [new file with mode: 0644]
Modules/_posixsubprocess.c
Modules/_threadmodule.c
Modules/posixmodule.c