]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-143010: Prevent a TOCTOU issue by only calling open once (#143011)
authorAZero13 <gfunni234@gmail.com>
Mon, 22 Dec 2025 17:48:11 +0000 (12:48 -0500)
committerGitHub <noreply@github.com>
Mon, 22 Dec 2025 17:48:11 +0000 (12:48 -0500)
commita88d1b8dab4cbd3180dd7f1acb44d627db90323b
tree99fa87b862e94a9b075c6aa66e059e5008a15f17
parent700e9fad70da3f1da008c3231749e3861fbce897
gh-143010: Prevent a TOCTOU issue by only calling open once (#143011)

* gh-143010: Prevent a TOCTOU issue by gh-143010: Prevent a TOCTOU issue by only calling open once

RDM: per  AZero13's research the 'x' option did not exist when this code was written,  This
modernization can thus drop the fd trick in _create_carefully and just use open with 'x' to achieve the same goal more securely.

Co-authored-by: sobolevn <mail@sobolevn.me>
Lib/mailbox.py
Misc/NEWS.d/next/Library/2025-12-20-01-49-02.gh-issue-143010._-SWX0.rst [new file with mode: 0644]