From 66efa6083419bcb400af54a22c421d4d521bba91 Mon Sep 17 00:00:00 2001 From: Ralf Gommers Date: Sun, 29 Nov 2026 17:35:21 +0100 Subject: [PATCH] Clarify greediness of inline metadata parsing spec See #1960 for the relevant context. The change to PEP 723 was made in python/peps#3505, which also links to the DPO discussion where this greediness was decided on. Closes #1960 --- source/specifications/inline-script-metadata.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/specifications/inline-script-metadata.rst b/source/specifications/inline-script-metadata.rst index f9df2f0f57..49b5b691fe 100644 --- a/source/specifications/inline-script-metadata.rst +++ b/source/specifications/inline-script-metadata.rst @@ -67,6 +67,14 @@ metadata: In circumstances where there is a discrepancy between the text specification and the regular expression, the text specification takes precedence. +The regular expression intentionally matches greedily, using the last possible +ending line within an uninterrupted sequence of valid embedded content lines. +This permits a standalone ``///`` within embedded content, as in the C# example +above; non-greedy matching would truncate that example. Consequently, apparent +blocks separated only by valid embedded content lines, including ``#``, are +matched as one block, with intervening delimiters included as content. An actual +blank line separates blocks. + Tools MUST NOT read from metadata blocks with types that have not been standardized by this specification.