Skip to content

Use Final instead of Literal in logging #7259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions stdlib/logging/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from string import Template
from time import struct_time
from types import FrameType, TracebackType
from typing import Any, ClassVar, Generic, Optional, Pattern, TextIO, TypeVar, Union, overload
from typing_extensions import Literal
from typing_extensions import Final, Literal

_SysExcInfoType = Union[tuple[type[BaseException], BaseException, Optional[TracebackType]], tuple[None, None, None]]
_ExcInfoType = Union[None, bool, _SysExcInfoType, BaseException]
Expand Down Expand Up @@ -245,14 +245,14 @@ class Logger(Filterer):
def hasHandlers(self) -> bool: ...
def callHandlers(self, record: LogRecord) -> None: ... # undocumented

CRITICAL: Literal[50]
FATAL: Literal[50]
ERROR: Literal[40]
WARNING: Literal[30]
WARN: Literal[30]
INFO: Literal[20]
DEBUG: Literal[10]
NOTSET: Literal[0]
CRITICAL: Final = 50
FATAL: Final = 50
ERROR: Final = 40
WARNING: Final = 30
WARN: Final = 30
INFO: Final = 20
DEBUG: Final = 10
NOTSET: Final = 0

class Handler(Filterer):
level: int # undocumented
Expand Down