-
-
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
09ac703
24a61a3
e108f93
2605bfa
aa601fb
cc157e3
2a43832
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,47 @@ | ||
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( | ||
# asyncio.iscoroutinefunction is deprecated, expecting a warning. | ||
def test_iscoroutinefunction_asyncio( | ||
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import sys | ||
from collections.abc import Awaitable, Callable, Coroutine | ||
from typing import Any, TypeVar, overload | ||
from typing_extensions import ParamSpec, TypeGuard, TypeIs | ||
from typing_extensions import ParamSpec, TypeGuard, TypeIs, deprecated | ||
|
||
# Keep asyncio.__all__ updated with any changes to __all__ here | ||
if sys.version_info >= (3, 11): | ||
|
@@ -17,11 +17,15 @@ if sys.version_info < (3, 11): | |
def coroutine(func: _FunctionT) -> _FunctionT: ... | ||
|
||
@overload | ||
@deprecated("Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead") | ||
def iscoroutinefunction(func: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ... | ||
@overload | ||
@deprecated("Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead") | ||
def iscoroutinefunction(func: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, _T]]]: ... | ||
@overload | ||
@deprecated("Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead") | ||
def iscoroutinefunction(func: Callable[_P, object]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, Any]]]: ... | ||
@overload | ||
@deprecated("Deprecated in Python 3.14; use inspect.iscoroutinefunction() instead") | ||
Comment on lines
+20
to
+29
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. |
||
def iscoroutinefunction(func: object) -> TypeGuard[Callable[..., Coroutine[Any, Any, Any]]]: ... | ||
def iscoroutine(obj: object) -> TypeIs[Coroutine[Any, Any, Any]]: ... |
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 | ||
|
Uh oh!
There was an error while loading. Please reload this page.