Repository navigation
Honor custom default section names in INI serialization - #642
Open
Master-Norna wants to merge 1 commit into
Open
Master-Norna wants to merge 1 commit into
Master-Norna wants to merge 1 commit into
Conversation
Master-Norna
force-pushed
the
fix/ini-default-section
branch
from
October 25, 2026 15:23
a539ba7 to
e0686a9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #642 +/- ##
==========================================
- Coverage 98.70% 98.70% -0.01%
==========================================
Files 65 65
Lines 2476 2475 -1
==========================================
- Hits 2444 2443 -1
Misses 32 32
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe your changes
Honor
RawConfigParser.default_sectionwhen reading and writing top-level INI defaults, instead of always accessing the literalDEFAULTsection.The public INI methods forward configparser options, but using a custom default section currently fails:
The decoder raises
ValueErrorwrappingNoSectionError: No section: 'DEFAULT'; the encoder raisesNoSectionErrordirectly. With a custom default section, a literal[DEFAULT]is an ordinary section. If it is present, the same bug can silently read its override as a root default, or write a root default into that ordinary section and overwrite its value.Use the parser's configured default section in both paths and remove the unused constant import. Add regressions for typed defaults and inheritance/overrides, the constructor, valueless defaults, emitted INI text, and keeping a literal
[DEFAULT]section separate from the custom defaults. The normalDEFAULTbehavior is unchanged.Related issue
Found while reviewing the INI implementation. No separate issue has been opened. All-state issue/PR searches, a scan of all 628 available issue/PR titles and bodies, and related INI timelines found no existing report or patch for this behavior. #618 concerns valueless option conversion rather than custom default section names.
Validation
Windows, Python 3.12.14, dependencies from
requirements.txtandrequirements-test.txt:coverage run --source=benedict -m unittestruns 995 tests successfully; total coverage is 99%, and the INI serializer is 100% covered. The clean baseline runs 990 tests successfully.pre-commit run --all-files.Checklist before requesting a review
AI assistance disclosure: Agent Yan investigated and reproduced the problem, prepared the patch and tests, reviewed the changes, ran verification, and drafted this description.