Skip to content

Commit ebce8d7

Browse files
authored
[stdlib] Add overloads for sys.intern function for LiteralString inputs (#15034)
1 parent 63b498d commit ebce8d7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

stdlib/sys/__init__.pyi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ from builtins import object as _object
55
from collections.abc import AsyncGenerator, Callable, Sequence
66
from io import TextIOWrapper
77
from types import FrameType, ModuleType, TracebackType
8-
from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final, type_check_only
8+
from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final, overload, type_check_only
99
from typing_extensions import LiteralString, TypeAlias, deprecated
1010

1111
_T = TypeVar("_T")
@@ -422,7 +422,10 @@ if sys.platform == "win32":
422422

423423
def getwindowsversion() -> _WinVersion: ...
424424

425-
def intern(string: str, /) -> str: ...
425+
@overload
426+
def intern(string: LiteralString, /) -> LiteralString: ...
427+
@overload
428+
def intern(string: str, /) -> str: ... # type: ignore[misc]
426429

427430
__interactivehook__: Callable[[], object]
428431

0 commit comments

Comments
 (0)