]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-137335: Fix unlikely name conflicts for named pipes in multiprocessing and asyncio...
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 24 Feb 2026 11:27:49 +0000 (13:27 +0200)
committerGitHub <noreply@github.com>
Tue, 24 Feb 2026 11:27:49 +0000 (13:27 +0200)
commitd6a71f4690c702892644b1fbae90ae9ef733a8ab
tree37ce5996abfe3130e4dc73f1ffe43740086d3257
parentca66d3c40cd9ac1fb94dd7cd79ccb8fecf019527
gh-137335: Fix unlikely name conflicts for named pipes in multiprocessing and asyncio on Windows (#137389)

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.
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]