-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
The first attempt to hande the format
property during logging.Formatter initilization removes the .
dictionary from the config
#110875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
format
property during formatter initilization removes .
from config
on the first attemptformat
property during logging.Formatter initilization removes the .
dictionary from the config
vsajip
added a commit
to vsajip/cpython
that referenced
this issue
Oct 16, 2023
vsajip
added a commit
that referenced
this issue
Nov 9, 2023
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
Nov 9, 2023
…tion c… (pythonGH-110943) (cherry picked from commit a5f29c9) Co-authored-by: Vinay Sajip <[email protected]>
vsajip
added a commit
to vsajip/cpython
that referenced
this issue
Nov 9, 2023
…tion c… (pythonGH-110943) (cherry picked from commit a5f29c9)
vsajip
added a commit
to vsajip/cpython
that referenced
this issue
Nov 9, 2023
…nfiguration c… (pythonGH-110943). (cherry picked from commit a5f29c9) Co-authored-by: Vinay Sajip <[email protected]>
vsajip
added a commit
that referenced
this issue
Nov 9, 2023
…ation c… (GH-110943) (GH-111911) Co-authored-by: Vinay Sajip <[email protected]>
vsajip
added a commit
that referenced
this issue
Nov 9, 2023
…ation correctly. (GH-110943) (GH-111914) Co-authored-by: Vinay Sajip <[email protected]>
aisk
pushed a commit
to aisk/cpython
that referenced
this issue
Feb 11, 2024
Glyphack
pushed a commit
to Glyphack/cpython
that referenced
this issue
Sep 2, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug report
Bug description:
When the library tries to initialize a formatter and comes across the old
format
property, it falls back to an error handler, but before it does that, it pops the.
dicationary from theconfig
making it impossible to process it later during the second call toself.configure_custom(config)
https://github.com/python/cpython/blob/main/Lib/logging/config.py#L480
This is whrere
configure_custom
callsprops = config.pop('.', None)
, but it does that beforeresult = c(**kwargs)
which throws an exception when it finds theformat
property.Then then initialization continues here inside the
except
that callsconfigure_custom
for the second time, but this time without the.
in theconfig
so it's skipped.https://github.com/python/cpython/blob/main/Lib/logging/config.py#L670
I guess the function
configure_custom
should callprops = config.pop('.', None)
afterresult = c(**kwargs)
so that the.
remains in theconfig
for the second call in case an exception is thrown during the first try.Example
This config won't initialize the
custom_property
ofMyFormatter
:The formatter is implemented like this:
CPython versions tested on:
3.10
Operating systems tested on:
Windows
Linked PRs
The text was updated successfully, but these errors were encountered: