Skip to content

Commit ed19811

Browse files
authored
Disallow False to be passed to LogRecord(exc_info) (#16541)
1 parent b1bb84f commit ed19811

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

‎stdlib/logging/__init__.pyi‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,13 +307,14 @@ class Filter:
307307
def filter(self, record: LogRecord) -> bool: ...
308308

309309
class LogRecord:
310-
# args can be set to None by logging.handlers.QueueHandler
311-
# (see https://bugs.python.org/issue44473)
310+
# args can be set to None by logging.handlers.QueueHandler, which
311+
# contradicts the LogRecord documentation, but seems to be intentional,
312+
# see https://github.com/python/cpython/issues/88639
312313
args: _ArgsType | None
313314
asctime: str
314315
created: float
315-
# Logger._log() only normalizes truthy exc_info values so
316-
# exc_info=False ends up on the record unchanged.
316+
# Prior to Python 3.16, Logger._log() only normalizes truthy exc_info
317+
# values so exc_info=False ends up on the record unchanged.
317318
exc_info: _SysExcInfoType | Literal[False] | None
318319
exc_text: str | None
319320
filename: str
@@ -344,8 +345,11 @@ class LogRecord:
344345
pathname: str,
345346
lineno: int,
346347
msg: object,
348+
# args can be set to None by logging.handlers.QueueHandler, which
349+
# contradicts the LogRecord documentation, but seems to be intentional,
350+
# see https://github.com/python/cpython/issues/88639
347351
args: _ArgsType | None,
348-
exc_info: _SysExcInfoType | Literal[False] | None,
352+
exc_info: _SysExcInfoType | None,
349353
func: str | None = None,
350354
sinfo: str | None = None,
351355
) -> None: ...

0 commit comments

Comments
 (0)