Skip to content

Commit

Permalink
Replaced typing.Self with typing_extensions.Self (#12744)
Browse files Browse the repository at this point in the history
Fix incorrect Self import from typing instead of typing_extensions.

---------

Co-authored-by: Bruno Oliveira <[email protected]>
  • Loading branch information
Avasam and nicoddemus authored Aug 29, 2024
1 parent ab259a3 commit c947145
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog/12744.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed typing compatibility with Python 3.9 or less -- replaced `typing.Self` with `typing_extensions.Self` -- by :user:`Avasam`
3 changes: 2 additions & 1 deletion src/_pytest/doctest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@

if TYPE_CHECKING:
import doctest
from typing import Self

from typing_extensions import Self

DOCTEST_REPORT_CHOICE_NONE = "none"
DOCTEST_REPORT_CHOICE_CDIFF = "cdiff"
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@


if TYPE_CHECKING:
from typing import Self
from typing_extensions import Self

# Imported here due to circular import.
from _pytest.main import Session
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@


if TYPE_CHECKING:
from typing import Self
from typing_extensions import Self


def pytest_addoption(parser: Parser) -> None:
Expand Down

0 comments on commit c947145

Please sign in to comment.