Skip to content

Conversation

@Rogdham
Copy link
Contributor

@Rogdham Rogdham commented Jul 5, 2025

Using the mapping protocol access to create unnamed section was not supported.

With this PR you can use it:

>>> cfg = configparser.ConfigParser(allow_unnamed_section=True)
>>> cfg[configparser.UNNAMED_SECTION] = {"foo": "bar"}
>>> cfg.write(fobj)

@Rogdham
Copy link
Contributor Author

Rogdham commented Jul 5, 2025

I have opened this PR as a feature request, but if you think @jaraco that this should be a bugfix (to be included in 3.14) for gh-123049, tell me and I will open an alternative PR accordingly!

@ZeroIntensity
Copy link
Member

If we do decide to backport (which I don't think we should), we can automatically backport to 3.14 with the bot. No need for an extra PR.

@Rogdham
Copy link
Contributor Author

Rogdham commented Jul 5, 2025

we can automatically backport to 3.14 with the bot. No need for an extra PR

Yes you are right! I meant to reference gh-123049 and not gh-136282 in that case, but I guess it does not matter much at the end of the day

@merwok
Copy link
Member

merwok commented Nov 27, 2025

I would see this as a bugfix, I can’t imagine someone using mapping protocol + unnamed section and wanting the output [<UNNAMED_SECTION>].

PR LGTM

@merwok merwok requested a review from ambv November 27, 2025 21:30
@merwok
Copy link
Member

merwok commented Dec 18, 2025

@encukou what do you think of fix vs feature classification? (with the consequence of backporting or not)

@ZeroIntensity
Copy link
Member

I don't remember my reasons for objecting to this as a bugfix -- if both of you are happy with backporting, let's do that.

@encukou encukou merged commit 4aef138 into python:main Dec 19, 2025
46 checks passed
@encukou
Copy link
Member

encukou commented Dec 19, 2025

@hugovk is the authority here.

I'm leaning towards bugfix.

@hugovk
Copy link
Member

hugovk commented Dec 19, 2025

Bugfix is fine by me.

@hugovk hugovk added the needs backport to 3.14 bugs and security fixes label Dec 19, 2025
@miss-islington-app
Copy link

Thanks @Rogdham for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 19, 2025
…otocol access (pythonGH-136313)

(cherry picked from commit 4aef138)

Co-authored-by: Rogdham <3994389+Rogdham@users.noreply.github.com>
@bedevere-app
Copy link

bedevere-app bot commented Dec 19, 2025

GH-142978 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Dec 19, 2025
@Rogdham Rogdham deleted the fix-configparser-unnamed-section-creation-mapping branch December 19, 2025 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants