diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2023-11-09 18:55:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-09 18:55:22 (GMT) |
commit | a5f29c9faf046b9ef3e498a0bc63dbc29017b5e3 (patch) | |
tree | 9a8586f3b9c25439fb2546f5a81e4a669718de1f /Lib/logging | |
parent | 7d21e3d5ee9858aee570aa6c5b6a6e87d776f4b5 (diff) | |
download | cpython-a5f29c9faf046b9ef3e498a0bc63dbc29017b5e3.zip cpython-a5f29c9faf046b9ef3e498a0bc63dbc29017b5e3.tar.gz cpython-a5f29c9faf046b9ef3e498a0bc63dbc29017b5e3.tar.bz2 |
gh-110875: Handle '.' properties in logging formatter configuration c… (GH-110943)
Diffstat (limited to 'Lib/logging')
-rw-r--r-- | Lib/logging/config.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/logging/config.py b/Lib/logging/config.py index 951bba7..4b520e3 100644 --- a/Lib/logging/config.py +++ b/Lib/logging/config.py @@ -482,10 +482,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) @@ -835,8 +835,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: @@ -854,6 +853,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) |