Skip to content

Commit 87e90bf

Browse files
authored
[mmap] Allow None for mmap.flush in Python 3.14 (#16284)
At runtime, `size` accepts `None` from `3.14.1` through `3.14.7` (the latest `3.14` release), and only accepts `-1` starting with `3.15.0`.
1 parent a88a395 commit 87e90bf

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

stdlib/@tests/stubtest_allowlists/py314.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,6 @@ concurrent.interpreters._crossinterp.UNBOUND_REMOVE
2424
# Condition functions are exported in __init__
2525
threading.Condition.locked
2626

27-
# Starting with Python 3.14.1, these methods accept None for some of their
28-
# parameters, but would raise a TypeError with Python 3.14.0.
29-
mmap.mmap.flush
30-
3127
# ====================================
3228
# Pre-existing errors from Python 3.13
3329
# ====================================

stdlib/mmap.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ class mmap:
7070

7171
def close(self) -> None: ...
7272
if sys.version_info >= (3, 15):
73-
def flush(self, offset: int = 0, size: int = ..., /, *, flags: int = 0) -> None: ...
73+
def flush(self, offset: int = 0, size: int = -1, /, *, flags: int = 0) -> None: ...
74+
elif sys.version_info >= (3, 14):
75+
# size default changed in Python 3.14.1
76+
def flush(self, offset: int = 0, size: int | None = None, /) -> None: ...
7477
else:
7578
def flush(self, offset: int = 0, size: int = ..., /) -> None: ...
7679

0 commit comments

Comments
 (0)