Kabir1618 opened a new pull request, #62286:
URL: https://github.com/apache/airflow/pull/62286
## Summary
- Fix `KeyError` when stdlib logging passes a single dict argument through
structlog (e.g. `logging.warning('msg %s', {'a': 10})`)
- CPython's `LogRecord.__init__` unwraps single-dict args into a bare dict,
but structlog's `PositionalArgumentsFormatter` expects a tuple and crashes when
indexing it
- Add `_normalize_positional_args` processor that re-wraps bare dict args
back into a tuple before `PositionalArgumentsFormatter` processes them
Closes #62201
## Test plan
- [x] Added 5 new tests in `TestStdlibDictArgs` covering: `%s` with dict,
named `%(key)` formatting, empty dict, multi-key dict, and normal positional
args
- [x] All 39 tests in `test_structlog.py` pass (34 existing + 5 new)
- [x] Manually verified the reproduction script from the issue works after
the fix
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]