Skip to content

gh-110875: Handle '.' properties in logging formatter configuration c… #110943

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

Merged
merged 3 commits into from
Nov 9, 2023

Conversation

vsajip
Copy link
Member

@vsajip vsajip commented Oct 16, 2023

@AlexWaygood
Copy link
Member

Not sure I'm the best reviewer here -- not very familiar with this code, and haven't used logging.Formatter much. But I can try to take a look tomorrow :)

@vsajip
Copy link
Member Author

vsajip commented Oct 17, 2023

It's a fairly simple localised change 😄

@vsajip vsajip requested a review from iritkatriel November 2, 2023 20:36
Copy link
Member

@encukou encukou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same logic is in DictConfigurator.configure_handler as well. Does that need a fix too?

@AlexWaygood AlexWaygood removed their request for review November 3, 2023 13:33
@vsajip
Copy link
Member Author

vsajip commented Nov 3, 2023

The same logic is in DictConfigurator.configure_handler as well. Does that need a fix too?

I don't think so, because the . key is popped, if present, just before the equivalent dict comprehension:

props = config.pop('.', None)
kwargs = {k: config[k] for k in config if valid_ident(k)}

@encukou
Copy link
Member

encukou commented Nov 9, 2023

Well, that's how it was in configure_custom too, before this PR.

Copy link
Member

@encukou encukou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good to me.
If the other site needs to be fixed, it can be done in a different PR. Or this one if you prefer :)

@vsajip
Copy link
Member Author

vsajip commented Nov 9, 2023

If the other site needs to be fixed, it can be done in a different PR. Or this one if you prefer :)

I think you're right. Better to make the logic consistent in both places, and it also improves the locality of behavior re. usage of props. Thanks very much for the review!

@vsajip vsajip merged commit a5f29c9 into python:main Nov 9, 2023
@vsajip vsajip deleted the fix-110875 branch November 9, 2023 18:55
@vsajip vsajip added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Nov 9, 2023
@miss-islington-app
Copy link

Thanks @vsajip for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @vsajip for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Sorry, @vsajip, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker a5f29c9faf046b9ef3e498a0bc63dbc29017b5e3 3.11

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 9, 2023
…tion c… (pythonGH-110943)

(cherry picked from commit a5f29c9)

Co-authored-by: Vinay Sajip <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Nov 9, 2023

GH-111911 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Nov 9, 2023
vsajip added a commit to vsajip/cpython that referenced this pull request Nov 9, 2023
vsajip added a commit to vsajip/cpython that referenced this pull request Nov 9, 2023
…nfiguration c… (pythonGH-110943).

(cherry picked from commit a5f29c9)

Co-authored-by: Vinay Sajip <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Nov 9, 2023

GH-111914 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Nov 9, 2023
vsajip added a commit that referenced this pull request Nov 9, 2023
vsajip added a commit that referenced this pull request Nov 9, 2023
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants