diff options
| author | shadchin <[email protected]> | 2026-06-24 07:09:14 +0300 |
|---|---|---|
| committer | shadchin <[email protected]> | 2026-06-24 07:31:09 +0300 |
| commit | 280914cd46f4411a2e01150bf9d9c53dff19fa66 (patch) | |
| tree | 841d7b8330cb51e86f2ea6e915e4904563321aca /contrib/tools/python3/Lib/multiprocessing/popen_fork.py | |
| parent | 1100ced6faf1d14f48cb041f885882d3b37491a2 (diff) | |
Update Python 3 to 3.13.14
commit_hash:9913a0288f56b5ddd0f99e5b2ff1569d491cbe5d
Diffstat (limited to 'contrib/tools/python3/Lib/multiprocessing/popen_fork.py')
| -rw-r--r-- | contrib/tools/python3/Lib/multiprocessing/popen_fork.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/contrib/tools/python3/Lib/multiprocessing/popen_fork.py b/contrib/tools/python3/Lib/multiprocessing/popen_fork.py index a57ef6bdad5..05593737dbb 100644 --- a/contrib/tools/python3/Lib/multiprocessing/popen_fork.py +++ b/contrib/tools/python3/Lib/multiprocessing/popen_fork.py @@ -64,7 +64,17 @@ class Popen(object): code = 1 parent_r, child_w = os.pipe() child_r, parent_w = os.pipe() - self.pid = os.fork() + # gh-146313: Tell the resource tracker's at-fork handler to keep + # the inherited pipe fd so this child reuses the parent's tracker + # (gh-80849) rather than closing it and launching its own. + from .resource_tracker import _fork_intent + _fork_intent.preserve_fd = True + try: + self.pid = os.fork() + finally: + # Reset in both parent and child so the flag does not leak + # into a subsequent raw os.fork() or nested Process launch. + _fork_intent.preserve_fd = False if self.pid == 0: try: atexit._clear() |
