Skip to content

Commit e6cc8ca

Browse files
phlogistonjohnmergify[bot]
authored andcommitted
sambacc: add version wrapper around typing.Self
Add version handling to typelets.py so that the sambacc code base can use the Self type more freely, concentrating the version workarounds in one place. Signed-off-by: John Mulligan <[email protected]>
1 parent 3305989 commit e6cc8ca

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

sambacc/typelets.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,17 @@
2020
"""
2121

2222
from types import TracebackType
23+
import sys
2324
import typing
2425

2526
ExcType = typing.Optional[typing.Type[BaseException]]
2627
ExcValue = typing.Optional[BaseException]
2728
ExcTraceback = typing.Optional[TracebackType]
29+
30+
31+
if sys.version_info >= (3, 11):
32+
from typing import Self
33+
elif typing.TYPE_CHECKING:
34+
from typing_extensions import Self
35+
else:
36+
Self = typing.Any

0 commit comments

Comments
 (0)