-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
When stacking LoggerAdapter instances in Python's logging module, an exception occurs if the inner adapter is initialized with extra=None. Specifically, the following code:
import logging
logging.basicConfig(level=logging.DEBUG, format="%(user)s %(message)s")
base_logger = logging.getLogger("base")
adapter_a = logging.LoggerAdapter(base_logger, extra={"user": "alice"}, merge_extra=True)
adapter_b = logging.LoggerAdapter(adapter_a)
# This raises: TypeError: 'NoneType' object is not a mapping
adapter_b.debug("Something")
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
No status