Skip to content

[3.13] gh-137335: Fix unlikely name conflicts for named pipes in multiprocessing and asyncio on Windows (GH-137389)#145171

Merged
serhiy-storchaka merged 1 commit intopython:3.13from
miss-islington:backport-d6a71f4-3.13
Feb 24, 2026
Merged

[3.13] gh-137335: Fix unlikely name conflicts for named pipes in multiprocessing and asyncio on Windows (GH-137389)#145171
serhiy-storchaka merged 1 commit intopython:3.13from
miss-islington:backport-d6a71f4-3.13

Conversation

@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Feb 24, 2026

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 d6a71f4)

Co-authored-by: Serhiy Storchaka storchaka@gmail.com

…processing and asyncio on Windows (pythonGH-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.
(cherry picked from commit d6a71f4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@serhiy-storchaka serhiy-storchaka enabled auto-merge (squash) February 24, 2026 11:29
@serhiy-storchaka serhiy-storchaka merged commit 6f1e0c4 into python:3.13 Feb 24, 2026
75 of 78 checks passed
@miss-islington miss-islington deleted the backport-d6a71f4-3.13 branch February 24, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants