Skip to content

Remove unused variable flagged by cython-lint 0.22 - #434

Closed
ilgrad wants to merge 1 commit into
flintlib:mainfrom
ilgrad:fix/cython-lint-unused-variable
Closed

ilgrad wants to merge 1 commit into
flintlib:mainfrom
ilgrad:fix/cython-lint-unused-variable

Conversation

@ilgrad

@ilgrad ilgrad commented Oct 13, 2026

Copy link
Copy Markdown

The Lint workflow installs cython-lint unpinned (uv pip install cython-lint --upgrade), and cython-lint 0.22.0 (released 2026-10-07) fails on main:

$ cython-lint src/
src/flint/types/fmpz.pxd:25:16: 'w' defined but unused (try prefixing with underscore?)

This makes the Lint job red on every PR opened since then (for example #433, which only touches .pyi files).

Cause. fmpz_set_pylong in src/flint/types/fmpz.pxd declares cdef ulong w but never uses it. It has been unused since the from_bytes/to_bytes rewrite in f349183; the w in ulong_from_little_endian just above is that function's own local. cython-lint 0.22.0 now checks unused locals in inline functions defined in .pxd files, which earlier releases did not report.

Fix. Delete the declaration.

Validation (Python 3.12, as in the Lint job):

cython-lint 0.21.1 cython-lint 0.22.0
main (cb37c77) pass fail (the error above)
this branch pass pass

cython -3 -I src (Cython 3.3.0) still compiles fmpz.pyx, fmpq.pyx and fmpz_poly.pyx, which cimport fmpz.pxd. I did not run the full build or the test suite locally; the declaration was dead, so no generated code that runs changes.

cython-lint 0.22.0 now reports unused cdef locals in inline functions
defined in .pxd files, so the Lint job fails on main with
fmpz.pxd:25:16: 'w' defined but unused. The variable has been unused
since the from_bytes/to_bytes conversion rewrite (f349183).
@oscarbenjamin

Copy link
Copy Markdown
Collaborator

You can just do this in the other PR. We don't need separate PRs and CI runs for something like this.

@ilgrad

ilgrad commented Oct 13, 2026

Copy link
Copy Markdown
Author

Thanks, moved into #433.

@ilgrad ilgrad closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants