-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add 3.14 Deprecations #14289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add 3.14 Deprecations #14289
Changes from all commits
87447ec
2e34041
c52f786
7b92886
5c5315a
74badea
0f14bad
da6d451
6661c35
1e2e617
ed65903
2bffae4
647bb88
d40fc6c
83efd5d
90c97d4
7eccbac
4f5c981
28a1743
3de835b
8c44563
94c49d6
7d0fb15
8f97cb9
5c89ea7
3034a9d
4fbdb04
3e6d012
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -1,25 +1,46 @@ | ||||||||
from __future__ import annotations | ||||||||
|
||||||||
import inspect | ||||||||
from asyncio import iscoroutinefunction | ||||||||
from collections.abc import Awaitable, Callable, Coroutine | ||||||||
from types import CoroutineType | ||||||||
from typing import Any | ||||||||
from typing_extensions import assert_type | ||||||||
|
||||||||
|
||||||||
def test_iscoroutinefunction( | ||||||||
def test_iscoroutinefunction_asyncio( | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
x: Callable[[str, int], Coroutine[str, int, bytes]], | ||||||||
y: Callable[[str, int], Awaitable[bytes]], | ||||||||
z: Callable[[str, int], str | Awaitable[bytes]], | ||||||||
xx: object, | ||||||||
) -> None: | ||||||||
if iscoroutinefunction(x): | ||||||||
if iscoroutinefunction(x): # pyright: ignore | ||||||||
assert_type(x, Callable[[str, int], Coroutine[str, int, bytes]]) | ||||||||
|
||||||||
if iscoroutinefunction(y): | ||||||||
if iscoroutinefunction(y): # pyright: ignore | ||||||||
assert_type(y, Callable[[str, int], Coroutine[Any, Any, bytes]]) | ||||||||
|
||||||||
if iscoroutinefunction(z): | ||||||||
if iscoroutinefunction(z): # pyright: ignore | ||||||||
assert_type(z, Callable[[str, int], Coroutine[Any, Any, Any]]) | ||||||||
|
||||||||
if iscoroutinefunction(xx): | ||||||||
if iscoroutinefunction(xx): # pyright: ignore | ||||||||
assert_type(xx, Callable[..., Coroutine[Any, Any, Any]]) | ||||||||
|
||||||||
|
||||||||
def test_iscoroutinefunction_inspect( | ||||||||
x: Callable[[str, int], Coroutine[str, int, bytes]], | ||||||||
y: Callable[[str, int], Awaitable[bytes]], | ||||||||
z: Callable[[str, int], str | Awaitable[bytes]], | ||||||||
xx: object, | ||||||||
) -> None: | ||||||||
if inspect.iscoroutinefunction(x): | ||||||||
assert_type(x, Callable[[str, int], Coroutine[str, int, bytes]]) | ||||||||
|
||||||||
if inspect.iscoroutinefunction(y): | ||||||||
assert_type(y, Callable[[str, int], CoroutineType[Any, Any, bytes]]) | ||||||||
|
||||||||
if inspect.iscoroutinefunction(z): | ||||||||
assert_type(z, Callable[[str, int], CoroutineType[Any, Any, Any]]) | ||||||||
|
||||||||
if inspect.iscoroutinefunction(xx): | ||||||||
assert_type(xx, Callable[..., CoroutineType[Any, Any, Any]]) |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -91,15 +91,38 @@ class _ActionsContainer: | |||||||
version: str = ..., | ||||||||
**kwargs: Any, | ||||||||
) -> Action: ... | ||||||||
def add_argument_group( | ||||||||
self, | ||||||||
title: str | None = None, | ||||||||
description: str | None = None, | ||||||||
*, | ||||||||
prefix_chars: str = ..., | ||||||||
argument_default: Any = ..., | ||||||||
conflict_handler: str = ..., | ||||||||
) -> _ArgumentGroup: ... | ||||||||
if sys.version_info >= (3, 14): | ||||||||
@overload | ||||||||
def add_argument_group( | ||||||||
self, | ||||||||
title: str | None = None, | ||||||||
description: str | None = None, | ||||||||
*, | ||||||||
argument_default: Any = ..., | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While we're here:
Suggested change
|
||||||||
conflict_handler: str = ..., | ||||||||
) -> _ArgumentGroup: ... | ||||||||
@overload | ||||||||
@deprecated("Passing 'prefix_chars' to add_argument_group() is deprecated") | ||||||||
def add_argument_group( | ||||||||
self, | ||||||||
title: str | None = None, | ||||||||
description: str | None = None, | ||||||||
*, | ||||||||
prefix_chars: str = ..., | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
argument_default: Any = ..., | ||||||||
conflict_handler: str = ..., | ||||||||
) -> _ArgumentGroup: ... | ||||||||
else: | ||||||||
def add_argument_group( | ||||||||
self, | ||||||||
title: str | None = None, | ||||||||
description: str | None = None, | ||||||||
*, | ||||||||
prefix_chars: str = ..., | ||||||||
argument_default: Any = ..., | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
conflict_handler: str = ..., | ||||||||
) -> _ArgumentGroup: ... | ||||||||
|
||||||||
def add_mutually_exclusive_group(self, *, required: bool = False) -> _MutuallyExclusiveGroup: ... | ||||||||
def _add_action(self, action: _ActionT) -> _ActionT: ... | ||||||||
def _remove_action(self, action: Action) -> None: ... | ||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ from inspect import _SourceObjectType | |
from linecache import _ModuleGlobals | ||
from types import CodeType, FrameType, TracebackType | ||
from typing import IO, Any, ClassVar, Final, Literal, TypeVar | ||
from typing_extensions import ParamSpec, Self, TypeAlias | ||
from typing_extensions import ParamSpec, Self, TypeAlias, deprecated | ||
|
||
__all__ = ["run", "pm", "Pdb", "runeval", "runctx", "runcall", "set_trace", "post_mortem", "help"] | ||
if sys.version_info >= (3, 14): | ||
|
@@ -59,7 +59,15 @@ class Pdb(Bdb, Cmd): | |
stack: list[tuple[FrameType, int]] | ||
curindex: int | ||
curframe: FrameType | None | ||
curframe_locals: Mapping[str, Any] | ||
if sys.version_info >= (3, 13): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 3.13 due as - |
||
@property | ||
@deprecated("curframe_locals is deprecated. Derived debuggers should access pdb.Pdb.curframe.f_locals instead.") | ||
def curframe_locals(self) -> Mapping[str, Any]: ... | ||
@curframe_locals.setter | ||
@deprecated("curframe_locals is deprecated. Derived debuggers should access pdb.Pdb.curframe.f_locals instead.") | ||
def curframe_locals(self, value: Mapping[str, Any]) -> None: ... | ||
else: | ||
curframe_locals: Mapping[str, Any] | ||
if sys.version_info >= (3, 14): | ||
mode: _Mode | None | ||
colorize: bool | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit safer, since it means that the symbol can or can not exist: