Skip to content

Commit 07cd5c5

Browse files
paper42DanielNoord
authored andcommitted
Do not require typing_extensions on Python 3.11
19878a5 added an unconditional dependency on typing_extensions to fix tests with Python 3.10 3.11. This commit fixes this issue by only requiring typing_extensions on Python versions lower than 3.11 and using standard typing on Python 3.11 and newer. (cherry picked from commit 8581d9d)
1 parent 22dacff commit 07cd5c5

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Release date: TBA
1616

1717
Closes #1958
1818

19+
* Remove unnecessary typing_extensions dependency on Python 3.11 and newer
20+
1921
What's New in astroid 2.13.2?
2022
=============================
2123
Release date: 2023-01-08

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ dependencies = [
3636
"wrapt>=1.14,<2;python_version>='3.11'",
3737
"wrapt>=1.11,<2;python_version<'3.11'",
3838
"typed-ast>=1.4.0,<2.0;implementation_name=='cpython' and python_version<'3.8'",
39-
"typing-extensions>=4.0.0",
39+
"typing-extensions>=4.0.0;python_version<'3.11'",
4040
]
4141
dynamic = ["version"]
4242

tests/unittest_scoped_nodes.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,11 +1907,14 @@ def test_mro_typing_extensions(self):
19071907
import typing
19081908
import dataclasses
19091909
1910-
import typing_extensions
1910+
if sys.version_info >= (3, 8):
1911+
from typing import Protocol
1912+
else:
1913+
from typing_extensions import Protocol
19111914
19121915
T = typing.TypeVar("T")
19131916
1914-
class MyProtocol(typing_extensions.Protocol): pass
1917+
class MyProtocol(Protocol): pass
19151918
class EarlyBase(typing.Generic[T], MyProtocol): pass
19161919
class Base(EarlyBase[T], abc.ABC): pass
19171920
class Final(Base[object]): pass

0 commit comments

Comments
 (0)