diff --git a/stdlib/logging/__init__.pyi b/stdlib/logging/__init__.pyi index 8b19444a5d01..f25abff837b7 100644 --- a/stdlib/logging/__init__.pyi +++ b/stdlib/logging/__init__.pyi @@ -572,7 +572,14 @@ fatal = critical def disable(level: int = 50) -> None: ... def addLevelName(level: int, levelName: str) -> None: ... -def getLevelName(level: _Level) -> Any: ... +@overload +def getLevelName(level: int) -> str: ... + +# The str -> int case is considered a mistake, but retained for backward +# compatibility. See +# https://docs.python.org/3/library/logging.html#logging.getLevelName. +@overload +def getLevelName(level: str) -> Any: ... if sys.version_info >= (3, 11): def getLevelNamesMapping() -> dict[str, int]: ...