Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
Closed as not planned
Closed as not planned
Copy link
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
When decorating a async function with a decorator that uses @functools.wraps or update_wrapperinspect.iscoroutinefunction returns False.
The following code demonstrates this issue:
importfunctoolsimportinspectasyncdeffn(): passassertinspect.iscoroutinefunction(fn) defdecorator(fn): defwrapper(*args, **kwargs): returnfn(*args, **kwargs) returnwrapperassertnotinspect.iscoroutinefunction(decorator(fn)) defsignature_preserving_decorator(fn): @functools.wraps(fn)defwrapper(*args, **kwargs): returnfn(*args, **kwargs) returnwrapperassertinspect.iscoroutinefunction(signature_preserving_decorator(fn)) # AssertionErrorI would expect the last assert statement to pass
- CPython versions tested on: 3.10.8
- Operating system and architecture: Linux 5.19.17-2-MANJARO x86_64 GNU/Linux
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error