Skip to content

Commit 321c0ce

Browse files
authored
math, mimetypes, mmap, multiprocessing, sqlite: Python 3.13 updates (#12062)
1 parent b780ac0 commit 321c0ce

File tree

6 files changed

+22
-11
lines changed

6 files changed

+22
-11
lines changed

stdlib/@tests/stubtest_allowlists/py313.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,6 @@ mailbox.Maildir.get_info
125125
mailbox.Maildir.remove_flag
126126
mailbox.Maildir.set_flags
127127
mailbox.Maildir.set_info
128-
math.fma
129-
mimetypes.MimeTypes.guess_file_type
130-
mimetypes.__all__
131-
mimetypes.guess_file_type
132-
mmap.mmap.seekable
133-
multiprocessing.shared_memory.SharedMemory.__init__
134128
pdb.Pdb.MAX_CHAINED_EXCEPTION_DEPTH
135129
pdb.Pdb.completedefault
136130
pdb.Pdb.completenames
@@ -147,8 +141,6 @@ pydoc.tempfilepager
147141
pydoc.ttypager
148142
site.gethistoryfile
149143
site.register_readline
150-
sqlite3.Connection.iterdump
151-
sqlite3.dbapi2.Connection.iterdump
152144
sre_compile.SRE_FLAG_TEMPLATE
153145
sre_constants.SRE_FLAG_TEMPLATE
154146
sre_parse.SRE_FLAG_TEMPLATE

stdlib/math.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,4 @@ if sys.version_info >= (3, 9):
125125
def ulp(x: _SupportsFloatOrIndex, /) -> float: ...
126126

127127
if sys.version_info >= (3, 13):
128-
def fma(x: _SupportsFloatOrIndex, y: _SupportsFloatOrIndex, z: _SupportsFloatOrIndex) -> float: ...
128+
def fma(x: _SupportsFloatOrIndex, y: _SupportsFloatOrIndex, z: _SupportsFloatOrIndex, /) -> float: ...

stdlib/mimetypes.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from _typeshed import StrPath
23
from collections.abc import Sequence
34
from typing import IO
@@ -18,13 +19,19 @@ __all__ = [
1819
"common_types",
1920
]
2021

22+
if sys.version_info >= (3, 13):
23+
__all__ += ["guess_file_type"]
24+
2125
def guess_type(url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ...
2226
def guess_all_extensions(type: str, strict: bool = True) -> list[str]: ...
2327
def guess_extension(type: str, strict: bool = True) -> str | None: ...
2428
def init(files: Sequence[str] | None = None) -> None: ...
2529
def read_mime_types(file: str) -> dict[str, str] | None: ...
2630
def add_type(type: str, ext: str, strict: bool = True) -> None: ...
2731

32+
if sys.version_info >= (3, 13):
33+
def guess_file_type(path: StrPath, *, strict: bool = True) -> tuple[str | None, str | None]: ...
34+
2835
inited: bool
2936
knownfiles: list[str]
3037
suffix_map: dict[str, str]
@@ -44,3 +51,5 @@ class MimeTypes:
4451
def read(self, filename: str, strict: bool = True) -> None: ...
4552
def readfp(self, fp: IO[str], strict: bool = True) -> None: ...
4653
def read_windows_registry(self, strict: bool = True) -> None: ...
54+
if sys.version_info >= (3, 13):
55+
def guess_file_type(self, path: StrPath, *, strict: bool = True) -> tuple[str | None, str | None]: ...

stdlib/mmap.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ class mmap(Iterable[int], Sized):
7676
def __exit__(self, *args: Unused) -> None: ...
7777
def __buffer__(self, flags: int, /) -> memoryview: ...
7878
def __release_buffer__(self, buffer: memoryview, /) -> None: ...
79+
if sys.version_info >= (3, 13):
80+
def seekable(self) -> bool: ...
7981

8082
if sys.platform != "win32":
8183
MADV_NORMAL: int

stdlib/multiprocessing/shared_memory.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ __all__ = ["SharedMemory", "ShareableList"]
1111
_SLT = TypeVar("_SLT", int, float, bool, str, bytes, None)
1212

1313
class SharedMemory:
14-
def __init__(self, name: str | None = None, create: bool = False, size: int = 0) -> None: ...
14+
if sys.version_info >= (3, 13):
15+
def __init__(self, name: str | None = None, create: bool = False, size: int = 0, *, track: bool = True) -> None: ...
16+
else:
17+
def __init__(self, name: str | None = None, create: bool = False, size: int = 0) -> None: ...
18+
1519
@property
1620
def buf(self) -> memoryview: ...
1721
@property

stdlib/sqlite3/dbapi2.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,11 @@ class Connection:
428428
def executemany(self, sql: str, parameters: Iterable[_Parameters], /) -> Cursor: ...
429429
def executescript(self, sql_script: str, /) -> Cursor: ...
430430
def interrupt(self) -> None: ...
431-
def iterdump(self) -> Generator[str, None, None]: ...
431+
if sys.version_info >= (3, 13):
432+
def iterdump(self, *, filter: str | None = None) -> Generator[str, None, None]: ...
433+
else:
434+
def iterdump(self) -> Generator[str, None, None]: ...
435+
432436
def rollback(self) -> None: ...
433437
def set_authorizer(
434438
self, authorizer_callback: Callable[[int, str | None, str | None, str | None, str | None], int] | None

0 commit comments

Comments
 (0)