Skip to content

python/embedded_python: doc rule counts each docstring twice (open and close delimiters both match, no pairing) #2658

Closed

Description

@squid-protocol

Found by the #2560 rosetta classification sweep (python #2593, embedded_python #2573): both record doc = 2 per single planted docstring.

Cause

The python-family doc rule counts delimiter occurrences with no open/close pairing — one docstring's opening """ and closing """ each match, so every triple-quoted docstring counts twice. (This is the same "one construct, two markers" family as the javadoc /** @param */ corpus finding, but here it's structural: EVERY docstring double-counts regardless of content, so it can't be authored around corpus-side.)

Fix shape

Pair symmetric delimiters in the doc-rule match loop (count """/''' occurrences // 2, or match the full """...""" span non-greedily as one hit — mind ReDoS bounds per the 12 engine rules). Applies to python and embedded_python (shared/duplicated rule — check which). Golden-master re-bless: python-family doc counts roughly halve corpus-wide.

Cause-key doc-delimiter-double-count; found via keyword-rosetta classification.

Activity

  1. added
    bug
    core-engine
    on Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-engine

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions