Kakadus · GitHub

When I annotate an async function with @deprecated(...), inspect.iscoroutinefunction no longer returns True. This is not what I expect to happen, as with partial from functools this does not happen.

Consider the following code:

import inspect
from functools import partial
from typing_extensions import deprecated
async def coroutinefunction_a():
    pass
@deprecated("deprecated coroutine")
async def coroutinefunction_b():
    pass
assert inspect.iscoroutinefunction(coroutinefunction_a) is True  # correct
assert inspect.iscoroutinefunction(partial(coroutinefunction_a)) is True  # correct
assert inspect.iscoroutinefunction(coroutinefunction_b) is True  # fail

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

Read the original on github.com ↗