From be61a87f554cd0006be1aaf72c1023b07d5451e0 Mon Sep 17 00:00:00 2001 From: Jair Henrique Date: Mon, 27 Oct 2025 15:15:57 -0300 Subject: [PATCH] Uses iscoroutinefunction from inspect module --- opentelemetry-api/src/opentelemetry/util/_decorator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/opentelemetry-api/src/opentelemetry/util/_decorator.py b/opentelemetry-api/src/opentelemetry/util/_decorator.py index de9ee8718f7..b1a7f6c4259 100644 --- a/opentelemetry-api/src/opentelemetry/util/_decorator.py +++ b/opentelemetry-api/src/opentelemetry/util/_decorator.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import asyncio import contextlib import functools +import inspect from typing import TYPE_CHECKING, Callable, Generic, Iterator, TypeVar V = TypeVar("V") @@ -63,7 +63,7 @@ def __enter__(self) -> R: raise RuntimeError("generator didn't yield") from None def __call__(self, func: V) -> V: # pyright: ignore [reportIncompatibleMethodOverride] - if asyncio.iscoroutinefunction(func): + if inspect.iscoroutinefunction(func): @functools.wraps(func) # type: ignore async def async_wrapper(*args: Pargs, **kwargs: Pkwargs) -> R: # pyright: ignore [reportInvalidTypeVarUse]