You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: cython-lint can miss cross-file inline violations when pre-commit batches files #3246
Silent failure in infrastructure (pre-commit). (This happened to be exposed through ctk-next update 756.)
Description
The cython-lint 0.22.0 hook enabled by #3209 can miss cross-file violations when pre-commit splits files across processes. Its new rule checks for functions declared in a .pxd file but implemented as cdef inline in a .pyx file. The linter keeps declaration/implementation information only within one invocation, so it detects a violation only if both files reach the same process.
Pre-commit partitions its file arguments according to the available CPU count. Consequently, the same code and hook configuration can pass or fail solely because the worker count changes.
Evidence in public code
At public main commit 590a8bf, these three helpers are implemented as cdef inline:
All three have separate declarations in _stream.pxd:31–33. These are exactly the cases the new lint rule should report: placing the implementation in .pyx does not enable cross-module inlining.
Using the public commit above, pre-commit 4.7.0, cython-lint 0.22.0, and Cython 3.2.9, actual linter runs over pre-commit's partitions of the 108 eligible Cython files produced:
Workers
Placement of _stream.pyx and _stream.pxd
Result
2
Same process
Fails with all three inline violations
4
Different processes
Passes; all three violations are missed
The expected behavior is that both worker counts report the same violations. Changing CPU count or batching should not change which cross-file rules are enforced.
Suggested resolution
Add require_serial: true to the existing cython-lint hook so this file set is checked in one invocation:
Remove the ineffective inline keyword from the three .pyx definitions. If actual cross-module inlining is desired, move their complete implementations into .pxd instead.
Both changes matter: fixing these three helpers removes the current violations; serial execution addresses the parallel-batching blind spot for the current file set. The underlying cross-file detection behavior is also worth reporting to cython-lint upstream.
Activity
Fix NVIDIA#3246: Correctly check .pyx/.pxd dependencies, and fix inli…