Skip to content

python: args regex has no cdef/cpdef alternative -- reports 0 for every Cython function with a C return type #2238

Closed

Description

@squid-protocol

Found during a tri-comparison ledger sweep of python/function/existence/agree[gitgalaxy]_vs[ctags,tree_sitter].

Confirmed real, currently-reproducing GitGalaxy defect, distinct from the (already-fixed, #1999) existence-side Cython recall issue.

Every Cython function declared with a C return type before the name — e.g. cdef char *get_item_pointer(memoryview self, index: tuple) except NULL (cython/MemoryView.pxd:77) or cdef void *copy_data_to_temp({{memviewslice_name}} *src, ...) (cython/MemoryView.pyx:1191) — gets args=0 from GitGalaxy, when the real counts (confirmed via ctags) are 1–8.

Root cause: language_standards.py's python args rule only matches literal def/lambda — it has no cdef/cpdef alternative at all. A bare cdef name(...) with NO return type (e.g. cdef is_slice(self, obj)) happens to get the correct count purely by accident, because the regex's literal def matches the substring inside cdef itself and lands directly on the real name(...). The instant a return-type token (char, void, a Tempita {{...}} placeholder, etc.) sits between cdef/cpdef and the name, that accidental adjacency breaks, the regex search fails, and the args count falls back to its 0 default.

Confirmed corpus-wide, not just the sample: 37 real functions in cython/MemoryView.pyx/.pxd alone show args=0 in GitGalaxy vs. ctags' correct nonzero counts, including memoryview_copy_contents, array_cwrapper, memoryview_check, transpose_memslice, _unellipsify, _copy_strided_to_strided, slice_assign_scalar, and ~30 more.

Suggested fix: mirror func_start's own cdef/cpdef return-type-skipping structure (already correct, per #1999) in the args rule, so it can locate the real (...) parameter list past an intervening return-type token instead of relying on def's accidental substring adjacency.

Activity

  1. added
    bug
    core-engine
    threat: false-negative
    on Aug 26, 2026
  2. added 6 commits that reference this issue on Aug 26, 2026
    cb2d310
    e91a2ff
    8ee5367
    f4d2229
    d914281
    dc6a5d1
  3. added this to the v2.4.9 milestone on Aug 31, 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-enginethreat: false-negative

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions