Skip to content

Commit e932a07

Browse files
committed
ast, configparser, glob: Python3.13 updates
1 parent 41cc4f9 commit e932a07

File tree

5 files changed

+52
-18
lines changed

5 files changed

+52
-18
lines changed

stdlib/@tests/stubtest_allowlists/py313.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@
33
# =========================
44

55
# TODO: triage these new errors
6-
_ast.PyCF_OPTIMIZED_AST
76
_collections_abc.dict_items.isdisjoint
87
_collections_abc.dict_keys.isdisjoint
98
_ctypes.POINTER
109
_ctypes.addressof
1110
_ctypes.alignment
1211
_ctypes.pointer
1312
_ctypes.sizeof
14-
_json.encode_basestring_ascii
1513
_thread.interrupt_main
1614
_thread.lock
1715
_thread.stack_size
@@ -20,7 +18,6 @@ _thread.start_new_thread
2018
_tkinter.TkappType.gettrace
2119
_tkinter.TkappType.settrace
2220
_tkinter.create
23-
ast.PyCF_OPTIMIZED_AST
2421
asyncio.AbstractEventLoop.create_server
2522
asyncio.AbstractServer.abort_clients
2623
asyncio.AbstractServer.close_clients
@@ -53,13 +50,6 @@ codecs.namereplace_errors
5350
codecs.replace_errors
5451
codecs.strict_errors
5552
codecs.xmlcharrefreplace_errors
56-
configparser.LegacyInterpolation
57-
configparser.MultilineContinuationError
58-
configparser.ParsingError.__init__
59-
configparser.ParsingError.combine
60-
configparser.RawConfigParser.__init__
61-
configparser.UNNAMED_SECTION
62-
configparser.__all__
6353
ctypes.POINTER
6454
ctypes._endian.DEFAULT_MODE
6555
ctypes._endian.RTLD_GLOBAL
@@ -101,8 +91,6 @@ enum.EnumDict
10191
enum._EnumDict.member_names
10292
enum.__all__
10393
filecmp.dircmp.__init__
104-
glob.__all__
105-
glob.translate
10694
importlib.metadata.DeprecatedTuple
10795
importlib.metadata.Distribution.origin
10896
importlib.metadata._meta.SimplePath.exists

stdlib/_ast.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ from typing_extensions import Unpack
66
PyCF_ONLY_AST: Literal[1024]
77
PyCF_TYPE_COMMENTS: Literal[4096]
88
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]
9+
PyCF_OPTIMIZED_AST: Literal[33792]
910

1011
# Used for node end positions in constructor keyword arguments
1112
_EndPositionT = typing_extensions.TypeVar("_EndPositionT", int, int | None, default=int | None) # noqa: Y023

stdlib/_json.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ class make_scanner:
4545
def __init__(self, context: make_scanner) -> None: ...
4646
def __call__(self, string: str, index: int) -> tuple[Any, int]: ...
4747

48-
def encode_basestring_ascii(s: str) -> str: ...
48+
def encode_basestring_ascii(s: str, /) -> str: ...
4949
def scanstring(string: str, end: int, strict: bool = ...) -> tuple[str, int]: ...

stdlib/configparser.pyi

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,31 @@ from re import Pattern
55
from typing import Any, ClassVar, Literal, TypeVar, overload
66
from typing_extensions import TypeAlias
77

8-
if sys.version_info >= (3, 12):
8+
if sys.version_info >= (3, 13):
9+
__all__ = (
10+
"NoSectionError",
11+
"DuplicateOptionError",
12+
"DuplicateSectionError",
13+
"NoOptionError",
14+
"InterpolationError",
15+
"InterpolationDepthError",
16+
"InterpolationMissingOptionError",
17+
"InterpolationSyntaxError",
18+
"ParsingError",
19+
"MissingSectionHeaderError",
20+
"ConfigParser",
21+
"RawConfigParser",
22+
"Interpolation",
23+
"BasicInterpolation",
24+
"ExtendedInterpolation",
25+
"SectionProxy",
26+
"ConverterMapping",
27+
"DEFAULTSECT",
28+
"MAX_INTERPOLATION_DEPTH",
29+
"UNNAMED_SECTION",
30+
"MultilineContinuationError",
31+
)
32+
elif sys.version_info >= (3, 12):
933
__all__ = (
1034
"NoSectionError",
1135
"DuplicateOptionError",
@@ -71,8 +95,9 @@ class Interpolation:
7195
class BasicInterpolation(Interpolation): ...
7296
class ExtendedInterpolation(Interpolation): ...
7397

74-
class LegacyInterpolation(Interpolation):
75-
def before_get(self, parser: _Parser, section: str, option: str, value: str, vars: _Section) -> str: ...
98+
if sys.version_info < (3, 13):
99+
class LegacyInterpolation(Interpolation):
100+
def before_get(self, parser: _Parser, section: str, option: str, value: str, vars: _Section) -> str: ...
76101

77102
class RawConfigParser(_Parser):
78103
_SECT_TMPL: ClassVar[str] # undocumented
@@ -101,6 +126,7 @@ class RawConfigParser(_Parser):
101126
default_section: str = "DEFAULT",
102127
interpolation: Interpolation | None = ...,
103128
converters: _ConvertersMap = ...,
129+
allow_unnamed_section: bool = False,
104130
) -> None: ...
105131
@overload
106132
def __init__(
@@ -117,6 +143,7 @@ class RawConfigParser(_Parser):
117143
default_section: str = "DEFAULT",
118144
interpolation: Interpolation | None = ...,
119145
converters: _ConvertersMap = ...,
146+
allow_unnamed_section: bool = False,
120147
) -> None: ...
121148
@overload
122149
def __init__(
@@ -133,6 +160,7 @@ class RawConfigParser(_Parser):
133160
default_section: str = "DEFAULT",
134161
interpolation: Interpolation | None = ...,
135162
converters: _ConvertersMap = ...,
163+
allow_unnamed_section: bool = False,
136164
) -> None: ...
137165
def __len__(self) -> int: ...
138166
def __getitem__(self, key: str) -> SectionProxy: ...
@@ -300,7 +328,10 @@ class InterpolationSyntaxError(InterpolationError): ...
300328
class ParsingError(Error):
301329
source: str
302330
errors: list[tuple[int, str]]
303-
if sys.version_info >= (3, 12):
331+
if sys.version_info >= (3, 13):
332+
def __init__(self, source: str, *args: object) -> None: ...
333+
def combine(self, others: Sequence[ParsingError]) -> ParsingError: ...
334+
elif sys.version_info >= (3, 12):
304335
def __init__(self, source: str) -> None: ...
305336
else:
306337
def __init__(self, source: str | None = None, filename: str | None = None) -> None: ...
@@ -311,3 +342,11 @@ class MissingSectionHeaderError(ParsingError):
311342
lineno: int
312343
line: str
313344
def __init__(self, filename: str, lineno: int, line: str) -> None: ...
345+
346+
if sys.version_info >= (3, 13):
347+
class _UNNAMED_SECTION: ...
348+
UNNAMED_SECTION: _UNNAMED_SECTION
349+
class MultilineContinuationError(ParsingError):
350+
lineno: int
351+
line: str
352+
def __init__(self, filename: str, lineno: int, line: str) -> None: ...

stdlib/glob.pyi

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
import sys
22
from _typeshed import StrOrBytesPath
3-
from collections.abc import Iterator
3+
from collections.abc import Iterator, Sequence
44
from typing import AnyStr
55

66
__all__ = ["escape", "glob", "iglob"]
77

8+
if sys.version_info >= (3, 13):
9+
__all__ += ["translate"]
10+
811
def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...
912
def glob1(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...
1013

@@ -40,3 +43,6 @@ else:
4043

4144
def escape(pathname: AnyStr) -> AnyStr: ...
4245
def has_magic(s: str | bytes) -> bool: ... # undocumented
46+
47+
if sys.version_info >= (3, 13):
48+
def translate(pat: AnyStr, *, recursive: bool = False, include_hidden: bool = False, seps: Sequence[str] | None = None) -> AnyStr: ...

0 commit comments

Comments
 (0)