-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
typing_extensions.deprecated
and warnings.deprecated
remove coroutine property; How to deprecate async functions?
#122088
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
Comments
import inspect
from functools import wraps
async def coroutinefunction_a():
pass
def wrapper(f):
@wraps(f)
def x():
return f()
return x
@wrapper
async def coroutinefunction_b():
pass
assert inspect.iscoroutinefunction(coroutinefunction_a) is True # correct
assert inspect.iscoroutinefunction(coroutinefunction_b) is True # fail
|
Previously discussed in: |
In that case, I definitely see the point of copying the flag in |
Yeah, that sounds good to me. Even if the flag is added to |
@AlexWaygood @JelleZijlstra Could one of you move this issue over to the cpython repository? This should probably be fixed in CPython first. |
…warnings.deprecated` (#122086) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
… in `@warnings.deprecated` (pythonGH-122086) (cherry picked from commit 375c9f6) Co-authored-by: Sebastian Rittau <srittau@rittau.biz> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
… in `@warnings.deprecated` (python#122086) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
… in `@warnings.deprecated` (python#122086) Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
When I annotate an async function with
@deprecated(...)
,inspect.iscoroutinefunction
no longer returns True. This is not what I expect to happen, as withpartial
fromfunctools
this does not happen.Consider the following code:
With typing_extensions and python3.13, the last assertion fails.
This is especially annoying since e.g. libraries use
inspect.iscoroutinefunction
to detect the type of function.I am not sure this is the correct place for this bug report, as this both happens with python 3.13 and typing_extensions on older python versions.
Linked PRs
@warnings.deprecated
#122086@warnings.deprecated
(GH-122086) #122156The text was updated successfully, but these errors were encountered: