]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.12] gh-104690 Disallow thread creation and fork at interpreter finalization (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 4 Jun 2023 04:32:00 +0000 (21:32 -0700)
committerGitHub <noreply@github.com>
Sun, 4 Jun 2023 04:32:00 +0000 (04:32 +0000)
commitc7a9d96a25a646d37cb97506019e82ee7493d1b3
tree28c1706b85c96d3b04e4a3ed56378acec7cee217
parentf629d5fc240e674652e6d183ada7a4e2dbdf3e18
[3.12] gh-104690 Disallow thread creation and fork at interpreter finalization (GH-104826) (#105277)

gh-104690 Disallow thread creation and fork at interpreter finalization (GH-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.

---------

(cherry picked from commit ce558e69d4087dd3653207de78345fbb8a2c7835)

Co-authored-by: chgnrdv <52372310+chgnrdv@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