]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
[3.13] gh-137335: Fix unlikely name conflicts for named pipes in multiprocessing...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 24 Feb 2026 17:20:53 +0000 (18:20 +0100)
committerGitHub <noreply@github.com>
Tue, 24 Feb 2026 17:20:53 +0000 (17:20 +0000)
commit6f1e0c4f01a6f3605d3ec9afa2d38bd65cdb0eb9
treed0fa88379213474f131808c0a5ece7ef607105fd
parentf1534307e80ef3a60d656bb60e31ed605ff312f0
[3.13] gh-137335: Fix unlikely name conflicts for named pipes in multiprocessing and asyncio on Windows (GH-137389) (GH-145171)

Since os.stat() raises an OSError for existing named pipe "\\.\pipe\...",
os.path.exists() always returns False for it, and tempfile.mktemp() can
return a name that matches an existing named pipe.

So, tempfile.mktemp() cannot be used to generate unique names for named
pipes. Instead, CreateNamedPipe() should be called in a loop with
different names until it completes successfully.
(cherry picked from commit d6a71f4690c702892644b1fbae90ae9ef733a8ab)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/asyncio/windows_utils.py
Lib/multiprocessing/connection.py
Misc/NEWS.d/next/Library/2025-08-04-23-20-43.gh-issue-137335.IIjDJN.rst [new file with mode: 0644]