Skip to content

Commit b8f7666

Browse files
authored
Merge branch 'main' into fix/fix-id-generator
2 parents 0a6bb4f + 58f2d16 commit b8f7666

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
([#4353](https://github.com/open-telemetry/opentelemetry-python/pull/4353))
1616
- sdk: don't log or print warnings when the SDK has been disabled
1717
([#4371](https://github.com/open-telemetry/opentelemetry-python/pull/4371))
18+
- Fix span context manager typing by using ParamSpec from typing_extensions
19+
([#4389](https://github.com/open-telemetry/opentelemetry-python/pull/4389))
1820

1921
## Version 1.29.0/0.50b0 (2024-12-11)
2022

opentelemetry-api/src/opentelemetry/util/_decorator.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@
1515
import asyncio
1616
import contextlib
1717
import functools
18-
import typing
19-
from typing import Callable, Generic, Iterator, TypeVar
18+
from typing import TYPE_CHECKING, Callable, Generic, Iterator, TypeVar
2019

2120
V = TypeVar("V")
2221
R = TypeVar("R") # Return type
2322
Pargs = TypeVar("Pargs") # Generic type for arguments
2423
Pkwargs = TypeVar("Pkwargs") # Generic type for arguments
2524

26-
if hasattr(typing, "ParamSpec"):
27-
# only available in python 3.10+
28-
# https://peps.python.org/pep-0612/
29-
P = typing.ParamSpec("P") # Generic type for all arguments
25+
# We don't actually depend on typing_extensions but we can use it in CI with this conditional
26+
# import. ParamSpec can be imported directly from typing after python 3.9 is dropped
27+
# https://peps.python.org/pep-0612/.
28+
if TYPE_CHECKING:
29+
from typing_extensions import ParamSpec
30+
31+
P = ParamSpec("P") # Generic type for all arguments
3032

3133

3234
class _AgnosticContextManager(

0 commit comments

Comments
 (0)