Skip to content

Python branch rule counts the .match( method call as a match statement #8034

Closed

Description

@squid-protocol

Problem

Python's branch rule matches the method call .match( as if it were the match statement (structural pattern
matching). Every re.match(...), pattern.match(...) or self.x.match(...) counts as a branch.

Found while rendering the docs/media explainer. In gitgalaxy/core/aperture.py:_has_generator_banner, the engine's
6 struct_branch hits include self.machine_gen_pattern.match(text).

for raw in head_lines:                                     -> for
    if self._machine_gen_anywhere.search(raw) or ...:      -> if, or
    if text and self.machine_gen_pattern.match(text):      -> if, and, match   <- method call, not a branch

Ask

Count match only as the statement: at line start (after indentation), followed by a subject and :. Never after
.. Sweep the other languages' branch rules for the same method-name collision (e.g. switch, when, case used
as identifiers or methods). Add positive and negative rule tests.

Same class as #8010 (a rule counting something it should not).

Activity

  1. added
    bug
    core-engine
    priority: low
    scope:sweep
    on Nov 7, 2026
  2. squid-protocol commented on Nov 8, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host melek, lease renewed 2026-11-08T15:04Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:melek label.

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

    bugclaim:melekcore-enginepriority: lowscope:sweep

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions