-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-107428: Added overridable methods for handling duplicate sections and options in 8000 ConfigParser. #107430
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
base: main
Are you sure you want to change the base?
Conversation
Most changes to Python require a NEWS entry. Please add it using the blurb_it web app or the blurb command-line tool. |
0695ec1
to
4b06849
Compare
See also #56871, #65528 and #75709. I think they all are parts of the same problem. #95546 is also related -- if duplicated sections or options are forbidden, they should not be changed before raising an exception. Simply adding underscored methods to raise exceptions is not a good solution of your problem. Because these methods is not a part of the public API, they will likely be changed or removed in more general solution of the above issues. |
I have read those issues before. The main difference in context here is that instead of suggesting how to reimplement the existing design, here we can keep the default behaviour while providing the option for the user to tweak it according to their business logic. |
For now, you can override If you want a solution which does not depend on Python version, the only way is to copy the code in your project or use a third-party package which implements your requirements. |
The points about Python versions are all valid. |
Since overriding private methods directly is not the best standard, an alternative approach I'm thinking about is allowing two new parameters during init of RawConfigParser. They will accept functions and default to |
Uh oh!
There was an error while loading. Please reload this page.