Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tools/unwrap_self.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"""

import argparse
import io
import math
import secrets
import struct
Expand Down Expand Up @@ -329,7 +330,7 @@ def region_for(offset, size):

destination.parent.mkdir(parents=True, exist_ok=True)
temporary_path = destination.parent / (".unwrap-self-" + secrets.token_hex(16))
temporary = temporary_path.open("xb")
temporary = io.open(temporary_path, "xb")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked: on 3.9 and on 3.11 and newer this is the same call Path.open made; on 3.10 Path.open resolves through pathlib._NormalAccessor.open, a copy of io.open taken at import, which is why the tests' patch("io.open") missed it there. "xb" keeps the exclusive creation, and 51 tests pass here on 3.13.9.

try:
with temporary:
temporary.write(result)
Expand Down
Loading