Skip to content

Commit daab0fc

Browse files
authored
Merge branch 'main' into add-asyncio-deprecation
2 parents 300644c + 6b4691d commit daab0fc

File tree

26 files changed

+696
-618
lines changed

26 files changed

+696
-618
lines changed

stdlib/@tests/stubtest_allowlists/py313.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ inspect._ParameterKind.description # Still exists, but stubtest can't see it
166166
typing\._SpecialForm.* # Super-special typing primitive
167167
typing\.LiteralString # Super-special typing primitive
168168

169+
# Don't always exist at runtime
170+
(pdb.Pdb.curframe_locals)?
169171

170172
# ==================================================================
171173
# Allowlist entries that cannot or should not be fixed; 3.11 to 3.13

stdlib/argparse.pyi

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,40 @@ class _ActionsContainer:
9191
version: str = ...,
9292
**kwargs: Any,
9393
) -> Action: ...
94-
def add_argument_group(
95-
self,
96-
title: str | None = None,
97-
description: str | None = None,
98-
*,
99-
prefix_chars: str = ...,
100-
argument_default: Any = ...,
101-
conflict_handler: str = ...,
102-
) -> _ArgumentGroup: ...
94+
if sys.version_info >= (3, 14):
95+
@overload
96+
def add_argument_group(
97+
self,
98+
title: str | None = None,
99+
description: str | None = None,
100+
*,
101+
# argument_default's type must be valid for the arguments in the group
102+
argument_default: Any = ...,
103+
conflict_handler: str = ...,
104+
) -> _ArgumentGroup: ...
105+
@overload
106+
@deprecated("The `prefix_chars` parameter deprecated since Python 3.14.")
107+
def add_argument_group(
108+
self,
109+
title: str | None = None,
110+
description: str | None = None,
111+
*,
112+
prefix_chars: str,
113+
argument_default: Any = ...,
114+
conflict_handler: str = ...,
115+
) -> _ArgumentGroup: ...
116+
else:
117+
def add_argument_group(
118+
self,
119+
title: str | None = None,
120+
description: str | None = None,
121+
*,
122+
prefix_chars: str = ...,
123+
# argument_default's type must be valid for the arguments in the group
124+
argument_default: Any = ...,
125+
conflict_handler: str = ...,
126+
) -> _ArgumentGroup: ...
127+
103128
def add_mutually_exclusive_group(self, *, required: bool = False) -> _MutuallyExclusiveGroup: ...
104129
def _add_action(self, action: _ActionT) -> _ActionT: ...
105130
def _remove_action(self, action: Action) -> None: ...

stdlib/codecs.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from _typeshed import ReadableBuffer
55
from abc import abstractmethod
66
from collections.abc import Callable, Generator, Iterable
77
from typing import Any, BinaryIO, ClassVar, Final, Literal, Protocol, TextIO, overload, type_check_only
8-
from typing_extensions import Self, TypeAlias, disjoint_base
8+
from typing_extensions import Self, TypeAlias, deprecated, disjoint_base
99

1010
__all__ = [
1111
"register",
@@ -191,6 +191,7 @@ def getincrementaldecoder(encoding: _BufferedEncoding) -> _BufferedIncrementalDe
191191
def getincrementaldecoder(encoding: str) -> _IncrementalDecoder: ...
192192
def getreader(encoding: str) -> _StreamReader: ...
193193
def getwriter(encoding: str) -> _StreamWriter: ...
194+
@deprecated("Deprecated since Python 3.14. Use `open()` instead.")
194195
def open(
195196
filename: str, mode: str = "r", encoding: str | None = None, errors: str = "strict", buffering: int = -1
196197
) -> StreamReaderWriter: ...

stdlib/os/__init__.pyi

Lines changed: 53 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,19 +1395,48 @@ class _wrap_close:
13951395
def write(self, s: str, /) -> int: ...
13961396
def writelines(self, lines: Iterable[str], /) -> None: ...
13971397

1398-
def popen(cmd: str, mode: str = "r", buffering: int = -1) -> _wrap_close: ...
1399-
def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
1400-
def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig
1398+
if sys.version_info >= (3, 14):
1399+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1400+
def popen(cmd: str, mode: str = "r", buffering: int = -1) -> _wrap_close: ...
1401+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1402+
def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
1403+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1404+
def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig
1405+
1406+
else:
1407+
def popen(cmd: str, mode: str = "r", buffering: int = -1) -> _wrap_close: ...
1408+
def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
1409+
def spawnle(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise sig
14011410

14021411
if sys.platform != "win32":
1403-
def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
1404-
def spawnve(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
1412+
if sys.version_info >= (3, 14):
1413+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1414+
def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
1415+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1416+
def spawnve(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
1417+
1418+
else:
1419+
def spawnv(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
1420+
def spawnve(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
1421+
1422+
else:
1423+
if sys.version_info >= (3, 14):
1424+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1425+
def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int: ...
1426+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1427+
def spawnve(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, env: _ExecEnv, /) -> int: ...
1428+
1429+
else:
1430+
def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int: ...
1431+
def spawnve(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, env: _ExecEnv, /) -> int: ...
1432+
1433+
if sys.version_info >= (3, 14):
1434+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1435+
def system(command: StrOrBytesPath) -> int: ...
14051436

14061437
else:
1407-
def spawnv(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, /) -> int: ...
1408-
def spawnve(mode: int, path: StrOrBytesPath, argv: _ExecVArgs, env: _ExecEnv, /) -> int: ...
1438+
def system(command: StrOrBytesPath) -> int: ...
14091439

1410-
def system(command: StrOrBytesPath) -> int: ...
14111440
@final
14121441
class times_result(structseq[float], tuple[float, float, float, float, float]):
14131442
if sys.version_info >= (3, 10):
@@ -1440,10 +1469,22 @@ if sys.platform == "win32":
14401469
def startfile(filepath: StrOrBytesPath, operation: str = ...) -> None: ...
14411470

14421471
else:
1443-
def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
1444-
def spawnlpe(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise signature
1445-
def spawnvp(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
1446-
def spawnvpe(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
1472+
if sys.version_info >= (3, 14):
1473+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1474+
def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
1475+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1476+
def spawnlpe(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise signature
1477+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1478+
def spawnvp(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
1479+
@deprecated("Soft deprecated. Use the subprocess module instead.")
1480+
def spawnvpe(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
1481+
1482+
else:
1483+
def spawnlp(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ...
1484+
def spawnlpe(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: Any) -> int: ... # Imprecise signature
1485+
def spawnvp(mode: int, file: StrOrBytesPath, args: _ExecVArgs) -> int: ...
1486+
def spawnvpe(mode: int, file: StrOrBytesPath, args: _ExecVArgs, env: _ExecEnv) -> int: ...
1487+
14471488
def wait() -> tuple[int, int]: ... # Unix only
14481489
# Added to MacOS in 3.13
14491490
if sys.platform != "darwin" or sys.version_info >= (3, 13):

stdlib/pdb.pyi

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ from linecache import _ModuleGlobals
88
from rlcompleter import Completer
99
from types import CodeType, FrameType, TracebackType
1010
from typing import IO, Any, ClassVar, Final, Literal, TypeVar
11-
from typing_extensions import ParamSpec, Self, TypeAlias
11+
from typing_extensions import ParamSpec, Self, TypeAlias, deprecated
1212

1313
__all__ = ["run", "pm", "Pdb", "runeval", "runctx", "runcall", "set_trace", "post_mortem", "help"]
1414
if sys.version_info >= (3, 14):
@@ -60,7 +60,17 @@ class Pdb(Bdb, Cmd):
6060
stack: list[tuple[FrameType, int]]
6161
curindex: int
6262
curframe: FrameType | None
63-
curframe_locals: Mapping[str, Any]
63+
if sys.version_info >= (3, 13):
64+
@property
65+
@deprecated("The frame locals reference is no longer cached. Use 'curframe.f_locals' instead.")
66+
def curframe_locals(self) -> Mapping[str, Any]: ...
67+
@curframe_locals.setter
68+
@deprecated(
69+
"Setting 'curframe_locals' no longer has any effect as of 3.14. Update the contents of 'curframe.f_locals' instead."
70+
)
71+
def curframe_locals(self, value: Mapping[str, Any]) -> None: ...
72+
else:
73+
curframe_locals: Mapping[str, Any]
6474
if sys.version_info >= (3, 14):
6575
mode: _Mode | None
6676
colorize: bool

stdlib/threading.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ def currentThread() -> Thread: ...
5454
def get_ident() -> int: ...
5555
def enumerate() -> list[Thread]: ...
5656
def main_thread() -> Thread: ...
57-
def settrace(func: TraceFunction) -> None: ...
57+
def settrace(func: TraceFunction | None) -> None: ...
5858
def setprofile(func: ProfileFunction | None) -> None: ...
5959

6060
if sys.version_info >= (3, 12):
6161
def setprofile_all_threads(func: ProfileFunction | None) -> None: ...
62-
def settrace_all_threads(func: TraceFunction) -> None: ...
62+
def settrace_all_threads(func: TraceFunction | None) -> None: ...
6363

6464
if sys.version_info >= (3, 10):
6565
def gettrace() -> TraceFunction | None: ...

stubs/Flask-SocketIO/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version = "5.5.*"
1+
version = "5.6.*"
22
requires = ["Flask>=0.9"]
33
upstream_repository = "https://github.com/miguelgrinberg/flask-socketio"

stubs/django-filter/django_filters/filterset.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ class BaseFilterSet:
7777
cls, field: models.Field[Any, Any], field_name: str, lookup_expr: str | None = None
7878
) -> Filter: ... # Accepts any Django field type
7979
@classmethod
80-
def filter_for_lookup(cls, field: models.Field[Any, Any], lookup_type: str) -> type[Filter]: ... # Field type varies by model
80+
def filter_for_lookup(
81+
cls, field: models.Field[Any, Any], lookup_type: str # Field type varies by model
82+
) -> tuple[type[Filter], dict[str, Any]]: ...
8183

8284
class FilterSet(BaseFilterSet, metaclass=FilterSetMetaclass): ...
8385

stubs/gevent/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version = "25.9.*"
22
upstream_repository = "https://github.com/gevent/gevent"
3-
requires = ["types-greenlet", "types-psutil"]
3+
requires = ["types-greenlet", "types-psutil>=7.2.0"]
44

55
[tool.stubtest]
66
# Run stubtest on all platforms, since there is some platform specific stuff

stubs/gevent/gevent/events.pyi

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import sys
21
from collections.abc import Callable, Mapping, Sequence
32
from types import ModuleType
43
from typing import Any, Protocol, TypeVar, type_check_only
54
from typing_extensions import TypeAlias
65

76
from gevent.hub import Hub
87
from greenlet import greenlet as greenlet_t
8+
from psutil._ntuples import pmem
99

1010
_T = TypeVar("_T")
1111
# FIXME: While it would be nice to import Interface from zope.interface here so the
@@ -17,17 +17,6 @@ Interface: TypeAlias = Any
1717

1818
def implementer(interface: Interface, /) -> Callable[[_T], _T]: ...
1919

20-
# this is copied from types-psutil, it would be nice if we could just import this
21-
# but it doesn't seem like we can...
22-
if sys.platform == "linux":
23-
from psutil._pslinux import pmem
24-
elif sys.platform == "darwin":
25-
from psutil._psosx import pmem
26-
elif sys.platform == "win32":
27-
from psutil._pswindows import pmem
28-
else:
29-
class pmem(Any): ...
30-
3120
subscribers: list[Callable[[Any], object]]
3221

3322
@type_check_only

0 commit comments

Comments
 (0)