-
-
Notifications
You must be signed in to change notification settings - Fork 30.8k
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
ConfigParser replaces unnamed section on every read call #127096
Comments
Please, provide the contents of |
Done |
Due to network issues, I am unable to clone the cpython repository. The following are for reference: def _handle_rest(self, st, line, fpname):
# a section header or option header?
if self._allow_unnamed_section and st.cursect is None:
st.sectname = UNNAMED_SECTION
if self._sections.get(st.sectname) is None:
st.cursect = self._dict()
self._sections[st.sectname] = st.cursect
else:
st.cursect = self._sections[st.sectname]
self._proxies[st.sectname] = SectionProxy(self, st.sectname)
st.elements_added.add(st.sectname)
... # Omit subsequent code |
I am working on adding something in configparser, I can take a look and add a PR if you want. |
I created the PR myself. Thanks to everyone for your help! |
Thank you. PalmtopTiger created the PR. |
Bug report
Bug description:
I think the problem is somewhere here. The unnamed section is recreated on every call.
first.ini.txt
second.ini.txt
CPython versions tested on:
3.13
Operating systems tested on:
Windows
Linked PRs
The text was updated successfully, but these errors were encountered: