Skip to content

Commit c947145

Browse files
Avasamnicoddemus
andauthored
Replaced typing.Self with typing_extensions.Self (#12744)
Fix incorrect Self import from typing instead of typing_extensions. --------- Co-authored-by: Bruno Oliveira <[email protected]>
1 parent ab259a3 commit c947145

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

changelog/12744.bugfix.rst

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed typing compatibility with Python 3.9 or less -- replaced `typing.Self` with `typing_extensions.Self` -- by :user:`Avasam`

src/_pytest/doctest.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444

4545
if TYPE_CHECKING:
4646
import doctest
47-
from typing import Self
47+
48+
from typing_extensions import Self
4849

4950
DOCTEST_REPORT_CHOICE_NONE = "none"
5051
DOCTEST_REPORT_CHOICE_CDIFF = "cdiff"

src/_pytest/nodes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444

4545
if TYPE_CHECKING:
46-
from typing import Self
46+
from typing_extensions import Self
4747

4848
# Imported here due to circular import.
4949
from _pytest.main import Session

src/_pytest/python.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878

7979

8080
if TYPE_CHECKING:
81-
from typing import Self
81+
from typing_extensions import Self
8282

8383

8484
def pytest_addoption(parser: Parser) -> None:

0 commit comments

Comments
 (0)