Skip to content

Preserve literal inline comment markers in parsed values - #84

Closed
sricharanreddycheruku wants to merge 1 commit into
pytest-dev:mainfrom
sricharanreddycheruku:batch7-preserve-inline-comment-markers
Closed

sricharanreddycheruku wants to merge 1 commit into
pytest-dev:mainfrom
sricharanreddycheruku:batch7-preserve-inline-comment-markers

Conversation

@sricharanreddycheruku

Copy link
Copy Markdown

IniConfig.parse() currently truncates values at any # or ;, including URL fragments and semicolon-separated text. For example, http://example.org/#fragment becomes http://example.org/. Continuation lines have the same problem.

Only recognize an inline comment when its marker is preceded by whitespace, as proposed in #83. Inspect values before stripping leading whitespace so key=#literal stays literal while key= #comment is still an empty value. Apply the same rule to continuation lines and document it in the parsing API and README.

Addresses the inline-comment bug in #83. The malformed section header and broader compatibility-policy questions remain open.

Validation on Linux, Python 3.12:

  • The 20 new regression/control cases give 14 failures and 6 passes before the implementation change; all pass afterward.
  • Full test suite: 74 passed.
  • All configured pre-commit hooks pass: pyproject-fmt, Ruff lint, Ruff format and strict mypy.
  • git diff --check passes.

The existing constructor and strip_inline_comments=False behavior are preserved. Section header comment handling is unchanged.

@RonnyPfannschmidt

Copy link
Copy Markdown
Member

closing due to ai violation

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.

2 participants