Skip to content

Commit 36dcd70

Browse files
Add small Python 3.15 stdlib APIs (#15728)
1 parent 76b1f83 commit 36dcd70

6 files changed

Lines changed: 41 additions & 23 deletions

File tree

stdlib/@tests/stubtest_allowlists/py315.txt

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,6 @@ profiling.sampling.string_table
275275
profiling.tracing
276276
pydoc.Doc.STDLIB_DIR
277277
pydoc.Doc.getdocloc
278-
pyexpat.XMLParserType.SetBillionLaughsAttackProtectionActivationThreshold
279-
pyexpat.XMLParserType.SetBillionLaughsAttackProtectionMaximumAmplification
280278
re.Pattern.prefixmatch
281279
re.__all__
282280
re.prefixmatch
@@ -307,18 +305,6 @@ ssl.SSLObject.server_sigalg
307305
ssl.SSLSocket.client_sigalg
308306
ssl.SSLSocket.group
309307
ssl.SSLSocket.server_sigalg
310-
stat.STATX_ATTR_APPEND
311-
stat.STATX_ATTR_AUTOMOUNT
312-
stat.STATX_ATTR_COMPRESSED
313-
stat.STATX_ATTR_DAX
314-
stat.STATX_ATTR_ENCRYPTED
315-
stat.STATX_ATTR_IMMUTABLE
316-
stat.STATX_ATTR_MOUNT_ROOT
317-
stat.STATX_ATTR_NODUMP
318-
stat.STATX_ATTR_VERITY
319-
stat.STATX_ATTR_WRITE_ATOMIC
320-
symtable.Function.get_cells
321-
symtable.Symbol.is_cell
322308
symtable.symtable
323309
sys.__jit
324310
sys._monitoring
@@ -379,13 +365,6 @@ typing.Union
379365
typing._SpecialForm.__mro_entries__
380366
typing_extensions.__all__
381367
typing_extensions.Protocol
382-
unicodedata.block
383-
unicodedata.extended_pictographic
384-
unicodedata.grapheme_cluster_break
385-
unicodedata.indic_conjunct_break
386-
unicodedata.isxidcontinue
387-
unicodedata.isxidstart
388-
unicodedata.iter_graphemes
389368
unittest._log._AssertLogsContext.__init__
390369
unittest.case.TestCase.assertLogs
391370
urllib.parse._DefragResultBase.geturl
@@ -412,5 +391,3 @@ xml.etree.ElementTree.__all__
412391
xml.is_valid_name
413392
xml.utils
414393
zipimport.zipimporter.load_module
415-
zlib.adler32_combine
416-
zlib.crc32_combine

stdlib/pyexpat/__init__.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from _typeshed import ReadableBuffer, SupportsRead
23
from collections.abc import Callable
34
from pyexpat import errors as errors, model as model
@@ -32,6 +33,10 @@ class XMLParserType:
3233
# Added in Python 3.10.20, 3.11.15, 3.12.3, 3.13.10, 3.14.1
3334
def SetAllocTrackerActivationThreshold(self, threshold: int, /) -> None: ...
3435
def SetAllocTrackerMaximumAmplification(self, max_factor: float, /) -> None: ...
36+
if sys.version_info >= (3, 15):
37+
def SetBillionLaughsAttackProtectionActivationThreshold(self, threshold: int, /) -> None: ...
38+
def SetBillionLaughsAttackProtectionMaximumAmplification(self, max_factor: float, /) -> None: ...
39+
3540
@property
3641
def intern(self) -> dict[str, str]: ...
3742
buffer_size: int

stdlib/stat.pyi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,15 @@ FILE_ATTRIBUTE_VIRTUAL: Final = 65536
112112
if sys.version_info >= (3, 13):
113113
# https://github.com/python/cpython/issues/114081#issuecomment-2119017790
114114
SF_RESTRICTED: Final = 0x00080000
115+
116+
if sys.version_info >= (3, 15):
117+
STATX_ATTR_COMPRESSED: Final = 0x00000004
118+
STATX_ATTR_IMMUTABLE: Final = 0x00000010
119+
STATX_ATTR_APPEND: Final = 0x00000020
120+
STATX_ATTR_NODUMP: Final = 0x00000040
121+
STATX_ATTR_ENCRYPTED: Final = 0x00000800
122+
STATX_ATTR_AUTOMOUNT: Final = 0x00001000
123+
STATX_ATTR_MOUNT_ROOT: Final = 0x00002000
124+
STATX_ATTR_VERITY: Final = 0x00100000
125+
STATX_ATTR_DAX: Final = 0x00200000
126+
STATX_ATTR_WRITE_ATOMIC: Final = 0x00400000

stdlib/symtable.pyi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class Function(SymbolTable):
4646
def get_locals(self) -> tuple[str, ...]: ...
4747
def get_globals(self) -> tuple[str, ...]: ...
4848
def get_frees(self) -> tuple[str, ...]: ...
49+
if sys.version_info >= (3, 15):
50+
def get_cells(self) -> tuple[str, ...]: ...
51+
4952
def get_nonlocals(self) -> tuple[str, ...]: ...
5053

5154
class Class(SymbolTable):
@@ -79,6 +82,8 @@ class Symbol:
7982
if sys.version_info >= (3, 14):
8083
def is_comp_iter(self) -> bool: ...
8184
def is_comp_cell(self) -> bool: ...
85+
if sys.version_info >= (3, 15):
86+
def is_cell(self) -> bool: ...
8287

8388
def is_namespace(self) -> bool: ...
8489
def get_namespaces(self) -> Sequence[SymbolTable]: ...

stdlib/unicodedata.pyi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import sys
12
from _typeshed import ReadOnlyBuffer
3+
from collections.abc import Iterator
24
from typing import Final, Literal, TypeAlias, TypeVar, final, overload
35

46
ucd_3_2_0: UCD
@@ -25,6 +27,16 @@ _EastAsianWidth: TypeAlias = Literal["F", "H", "W", "Na", "A", "N"]
2527

2628
def east_asian_width(chr: str, /) -> _EastAsianWidth: ...
2729
def is_normalized(form: _NormalizationForm, unistr: str, /) -> bool: ...
30+
31+
if sys.version_info >= (3, 15):
32+
def block(chr: str, /) -> str: ...
33+
def extended_pictographic(chr: str, /) -> bool: ...
34+
def grapheme_cluster_break(chr: str, /) -> str: ...
35+
def indic_conjunct_break(chr: str, /) -> str: ...
36+
def isxidstart(chr: str, /) -> bool: ...
37+
def isxidcontinue(chr: str, /) -> bool: ...
38+
def iter_graphemes(unistr: str, start: int = 0, end: int = sys.maxsize, /) -> Iterator[str]: ...
39+
2840
def lookup(name: str | ReadOnlyBuffer, /) -> str: ...
2941
def mirrored(chr: str, /) -> int: ...
3042
@overload

stdlib/zlib.pyi

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ class _Decompress:
6060

6161
def adler32(data: ReadableBuffer, value: int = 1, /) -> int: ...
6262

63+
if sys.version_info >= (3, 15):
64+
def adler32_combine(adler1: int, adler2: int, len2: int, /) -> int: ...
65+
6366
if sys.version_info >= (3, 11):
6467
def compress(data: ReadableBuffer, /, level: int = -1, wbits: int = 15) -> bytes: ...
6568

@@ -70,5 +73,9 @@ def compressobj(
7073
level: int = -1, method: int = 8, wbits: int = 15, memLevel: int = 8, strategy: int = 0, zdict: ReadableBuffer | None = None
7174
) -> _Compress: ...
7275
def crc32(data: ReadableBuffer, value: int = 0, /) -> int: ...
76+
77+
if sys.version_info >= (3, 15):
78+
def crc32_combine(crc1: int, crc2: int, len2: int, /) -> int: ...
79+
7380
def decompress(data: ReadableBuffer, /, wbits: int = 15, bufsize: int = 16384) -> bytes: ...
7481
def decompressobj(wbits: int = 15, zdict: ReadableBuffer = b"") -> _Decompress: ...

0 commit comments

Comments
 (0)