Repository navigation
Conversation
Stop scanning when a trailing comment block has no following key. Keep column-zero comment detection unchanged so indented block scalar contents remain data. Add direct and Configuration.dump regressions, scalar round trips, and a changelog entry. Fixes beetbox#148. Related prior proposals: beetbox#61 (hebote) and beetbox#196 (binggao1230); this uses a narrow iterator-loop fix rather than their broader or flag-based implementations.
This branch has not been deployed
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.
Fixes #148.
Replace the unguarded
next()inrestore_yaml_commentswith afor/elseloop that stops cleanly when a trailing comment block has no following key. Orphan trailing comments and blank lines are discarded. Column-zero comment detection remains unchanged so indented#lines inside literal or folded block scalars remain string data.Add 18 cases covering trailing comments with and without final newlines, blank endings, comment-only/empty defaults, reordered keys,
Configuration.dump()with overridden defaults, and literal/folded scalar round trips. Include an Unreleased changelog entry.Related prior proposals: #61 by @hebote and #196 by @binggao1230, both closed without merging. This is a narrow iterator-exhaustion fix; it does not adopt broader indented-comment handling or change duplicate-key behavior.
Validation on Linux/Python 3.12.14, PyYAML 6.0.3:
StopIteration; scalar-preservation controls pass.test_bump_version_applies_sequential_changelog_updates. The same fixed-underline/current-date mismatch reproduces in a clean upstream worktree and is addressed separately in Make release changelog test independent of the date #211.test/test_valid.py:11; reproduced on unchanged upstream. Full-tree docstrfmt 2.0.1 now passes for all seven tracked RST files plusdocs/conf.py, checked individually with--ignore-cache --pyproject-config pyproject.toml --check --no-format-python-code-blocks --preserve-adornmentsto avoid multiprocessing. The same checks pass on the clean upstream baseline.StopIterationnow return normally.No Windows/other-Python run or remote CI pass is claimed. Prepared and checked with OpenAI Codex assistance; draft for maintainer review.