Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Open
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:
importlogginglogging.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 mappingadapter_b.debug("Something")
CPython versions tested on:
3.13
Operating systems tested on:
Linux
Linked PRs
- gh-138162: Fix logging.LoggerAdapter with merge_extra=True and without the extra argument #140511
- [3.14] gh-138162: Fix logging.LoggerAdapter with merge_extra=True and without the extra argument (GH-140511) #140784
- [3.13] gh-138162: Fix logging.LoggerAdapter with merge_extra=True and without the extra argument (GH-140511) #140785
Metadata
Metadata
Assignees
Labels
Projects
Status
No status