mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
[3.12] gh-110875: Handle '.' properties in logging formatter configuration c… (GH-110943) (GH-111911)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
This commit is contained in:
parent
fe7631e558
commit
09df271965
2 changed files with 41 additions and 5 deletions
|
@ -485,10 +485,10 @@ class BaseConfigurator(object):
|
|||
c = config.pop('()')
|
||||
if not callable(c):
|
||||
c = self.resolve(c)
|
||||
props = config.pop('.', None)
|
||||
# Check for valid identifiers
|
||||
kwargs = {k: config[k] for k in config if valid_ident(k)}
|
||||
kwargs = {k: config[k] for k in config if (k != '.' and valid_ident(k))}
|
||||
result = c(**kwargs)
|
||||
props = config.pop('.', None)
|
||||
if props:
|
||||
for name, value in props.items():
|
||||
setattr(result, name, value)
|
||||
|
@ -841,8 +841,7 @@ class DictConfigurator(BaseConfigurator):
|
|||
factory = functools.partial(self._configure_queue_handler, klass)
|
||||
else:
|
||||
factory = klass
|
||||
props = config.pop('.', None)
|
||||
kwargs = {k: config[k] for k in config if valid_ident(k)}
|
||||
kwargs = {k: config[k] for k in config if (k != '.' and valid_ident(k))}
|
||||
try:
|
||||
result = factory(**kwargs)
|
||||
except TypeError as te:
|
||||
|
@ -860,6 +859,7 @@ class DictConfigurator(BaseConfigurator):
|
|||
result.setLevel(logging._checkLevel(level))
|
||||
if filters:
|
||||
self.add_filters(result, filters)
|
||||
props = config.pop('.', None)
|
||||
if props:
|
||||
for name, value in props.items():
|
||||
setattr(result, name, value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue