| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Hello, and thanks for your contribution! I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA). Unfortunately we couldn't find an account corresponding to your GitHub username on bugs.python.org (b.p.o) to verify you have signed the CLA (this might be simply due to a missing "GitHub Name" entry in your b.p.o account settings). This is necessary for legal reasons before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue. Thanks again to your contribution and we look forward to looking at it! |
Sorry, something went wrong.
|
This PR closes https://bugs.python.org/issue22253 from 2014 While waiting for this change to land in Python, a huge amount of people seem to use these workarounds: |
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
|
This PR should be merged and not closed for being "stale". |
Sorry, something went wrong.
There was a problem hiding this comment.
Both test cases were successful:
test_no_first_section (Lib.test.test_configparser.SectionlessTestCase) ... ok test_no_section (Lib.test.test_configparser.SectionlessTestCase) ... ok
SO examples work, but if you print the key you get DEFAULT and if you want to see the get() you need to use a blank key ''.
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
|
Why is this not merged yet? It would be great to have! |
Sorry, something went wrong.
|
@ChristianSi Probably because #2735 (review) is not addressed. |
Sorry, something went wrong.
|
This PR is stuck for five years, so cc @ambv as a configparser expert. |
Sorry, something went wrong.
|
Any news on this one? |
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
|
@pslacerda It seems this PR got stalled because you didn't address the proposal to use a sentinel object instead of the empty string (as per your own suggestion). Could you implement that change to get this moving again? Also, the branch would have be to rebased or main merged into it to get it up-to-date. Would be great if we could finally get this completed! |
Sorry, something went wrong.
|
@arhadthedev Good to read from you. Could you maybe help us to get this finally merged into main? |
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
Even with big desire, nobody can merge any new feature until 3.12b1 is out. The release date is already urgently moved from the last Monday to May 22. From https://discuss.python.org/t/postponing-3-12-beta-1-feature-freeze/26406:
|
Sorry, something went wrong.
|
This PR is stale because it has been open for 30 days with no activity. |
Sorry, something went wrong.
There was a problem hiding this comment.
As well clarifying whether headerless options should leak into other sections, maybe there should be tests and documentation for the behaviour of:
Sorry, something went wrong.
| section proxies. | ||
|
|
||
| When `allow_unnamed_section` is True (default: False), options | ||
| without section are accepted: the section for this is |
There was a problem hiding this comment.
options without a section?
Sorry, something went wrong.
| return "<TOP_LEVEL>" | ||
|
|
||
| def __eq__(self, other): | ||
| return repr(self) == repr(other) |
There was a problem hiding this comment.
Why did __eq__ get implemented? It makes more sense to me to keep the default inherited implementation. Doesn’t the class only get instantiated once anyway?
Won’t this make a valid section headed [<TOP_LEVEL>] match the headerless section in some cases?
Sorry, something went wrong.
| @@ -0,0 +1,4 @@ | |||
| :class:`configparser.ConfigParser` now accepts unnamed sections before named | |||
| ones, if configured to do so. | |||
There was a problem hiding this comment.
“accepts an unnamed section before named ones” might be clearer
Sorry, something went wrong.
|
|
||
| When `allow_unnamed_section` is True (default: False), options | ||
| without section are accepted: the section for this is | ||
| ``configparser.UNNAMED_SECTION``. In the file, they are placed before |
There was a problem hiding this comment.
configparser.TOP_LEVEL?
Sorry, something went wrong.
| empty_lines_in_values=True, default_section='DEFAULT', | ||
| interpolation=<unset>, converters=<unset>): | ||
| interpolation=<unset>, converters=<unset>, | ||
| allow_unnamed_section=False): |
There was a problem hiding this comment.
allow_unnamed_section not implemented
Sorry, something went wrong.
There was a problem hiding this comment.
This seems ok.
Sorry, something went wrong.
|
this feature would be very important to integrate. Is it available yet? The Windows INI files and the GetProfileString family of APIs have had this undocumented behavior forever, where an empty section is absolutely present and used by software. See the following wine commits and bugs related to it: wine-mirror/wine@be678a5 I would like to use ConfigParser, but currently cannot due to this missing feature, so I am open coding the config file parsing, which I would gladly avoid. |
Sorry, something went wrong.
|
@vadmium Thanks for your review! @pslacerda Are you still around and willing to make the changes suggested in the review? They seem quite reasonable to me. |
Sorry, something went wrong.
|
@hw-claudio I alsolutely agree, it would be great to have! Sadly it seems that it's a low-prio, or even a no-prio feature for Python's core developers 😢 |
Sorry, something went wrong.
|
I don't even remember the original motivation why I did this PR. I failed to merge into this PR, so I did a new one. |
Sorry, something went wrong.
|
Finally seems that we will get this code into main. Thank you @ChristianSi! |
Sorry, something went wrong.
|
@pslacerda Wow, that's wonderful news, thanks a lot for all your effort! |
Sorry, something went wrong.
Co-authored-by: Furkan Onder <furkanonder@protonmail.com>
|
Thank you @ChristianSi and @jaraco, it finally got merged. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Add support to files that have key-value pairs before any section or no section at all. Unnamed sections are enabled when passing allow_unnamed_section=True to configparser.ConfigParser and are stored as an empty string.