fix(cuda.bindings): make cythonization warning-clean and enable -Werror
Summary
- Clear the Cython warnings that blocked enabling
warning_errorsforcuda.bindings(Fixes #2450) - Drop ignored
except *on Python-returningcudlacpdefs and reseal those generated files - Declare
LOAD_LIBRARY_SEARCH_SYSTEM32asconst DWORDin hand-writtenwindll.pxd - Enable
_CythonOptions.warning_errors = Trueincuda_bindings/build_hooks.py(matchingcuda.core) - Add source-level regression tests for these patterns
Cybind follow-up: the cudla emitter should stop attaching exception clauses to cpdefs that return Python objects so the next sync does not reintroduce those warnings.
Test plan
- [x] Local Cythonize of
cuda.bindingswithwarning_errors=Truesucceeds (27 extensions) - [x]
pytest cuda_bindings/tests/test_cython_warning_cleanliness.py— 4 passed - [x]
toolshed/check_generated_file_seals.pypasses for updatedcudla.{pxd,pyx} - [ ] CI source builds for
cuda.bindingson Linux/Windows
This pull request requires additional validation before any workflows can run on NVIDIA's runners.
Pull request vetters can view their responsibilities here.
Contributors can view more details about this message here.
Hi maintainers — gentle follow-up on this PR for #2450.
Could someone please:
- Vet / approve the PR so NVIDIA runners can run CI (
copy-pr-botis still waiting) - Review when convenient
- Assign related issue #2450 to me (@atiaomar1978-hub) so I can own follow-through
Happy to adjust based on feedback (including the cybind sync note in the description). cc @juenglin (issue author)
Thanks, Omar.
You may have noticed that some files under cuda_bindings are auto-generated, and the fix for those need to be made in a different place (the generator). We need to wait for that fix before we can merge this PR.
Regarding the pre-commit.ci failure, you might need to run pre-commit install in your virtual environment.
Thanks @juenglin — that makes sense, and I appreciate the guidance.
On the generated cudla files
Agreed that the lasting fix belongs in the cybind/generator path, not hand-editing sealed outputs. This PR already notes that in the description (the cudla emitter should stop attaching exception clauses to Python-returning cpdefs). I’m happy to hold merge until that generator change lands, then refresh/reseal cudla.{pxd,pyx} from a clean sync so we don’t reintroduce the warnings.
What remains useful in this PR once cybind is fixed:
windll.pxd: declareLOAD_LIBRARY_SEARCH_SYSTEM32asconst DWORD(hand-written)build_hooks.py: enable_CythonOptions.warning_errors = True(matchingcuda.core)- source-level regression tests in
test_cython_warning_cleanliness.py
If you’d rather split those from the temporary cudla reseal, I can reshape the PR — just say the word.
On pre-commit.ci
The failure was ruff format (one file). I’ve pushed a signed fix on this branch: a9f3036 (style: ruff-format cython warning cleanliness tests). pre-commit.ci is green again.
Ask When convenient, could you (or another maintainer) assign #2450 to me (@atiaomar1978-hub) and vet the PR for NVIDIA runners so full CI can run once we’re unblocked on cybind? Happy to adjust based on your preferred sequencing.