Skip to content

docs: explain intentional greediness of inline metadata parsing - #15

Open
harshitethic wants to merge 1 commit into
mainfrom
docs/1960-explain-inline-metadata-greediness
Open

harshitethic wants to merge 1 commit into
mainfrom
docs/1960-explain-inline-metadata-greediness

Conversation

@harshitethic

@harshitethic harshitethic commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Addresses pypa#1960.

The canonical PEP 723 regex can look surprisingly greedy when two metadata-looking comment blocks are adjacent. The current spec already defines the behavior, but the reason is easy to miss.

This change documents that:

  • consecutive valid comment-content lines are intentionally consumed as one block until the valid closing boundary;
  • a second opener inside an open block is invalid per the textual rules and tools may report it as an error;
  • the greediness is required so content can legitimately contain # ///... lines, as demonstrated by the existing embedded-C# example;
  • changing the regex repetition to non-greedy would incorrectly terminate those valid blocks.

No normative parsing rule or reference implementation is changed.


📚 Documentation preview 📚: https://python-packaging-user-guide--15.org.readthedocs.build/en/15/

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.

1 participant