Skip to content

Commit 8457bb0

Browse files
fix(cuda.bindings): make cythonization warning-clean and enable -Werror (#2463)
* fix(cuda.bindings): make cythonization warning-clean and enable -Werror Clear the Cython warnings that blocked matching cuda.core's warning_errors setting (#2450): drop ignored except clauses on Python-returning cudla cpdefs, declare LOAD_LIBRARY_SEARCH_SYSTEM32 as const in windll.pxd, and enable Cython Options.warning_errors in build_hooks. Add source-level regression tests so these patterns do not return. Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> * style: ruff-format cython warning cleanliness tests Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> * test(cuda.bindings): drop cython warning cleanliness tests Address review feedback: warning_errors in build_hooks already guards against Cython warning regressions, so the source-level tests add unnecessary maintenance cost. Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com> --------- Signed-off-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com> Co-authored-by: Omar Atie <atiaomar1978-hub@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 29acb74 commit 8457bb0

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

cuda_bindings/build_hooks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ def _build_cuda_bindings(debug=False):
137137
that metadata queries do not require a CUDA toolkit installation.
138138
"""
139139
from Cython.Build import cythonize
140+
from Cython.Compiler import Options as _CythonOptions
140141

141142
global _extensions
142143

@@ -230,6 +231,7 @@ def get_static_libraries(f):
230231
)
231232

232233
# Cythonize
234+
_CythonOptions.warning_errors = True
233235
cython_directives = {"language_level": 3, "embedsignature": True, "binding": True, "freethreading_compatible": True}
234236
if compile_for_coverage:
235237
cython_directives["linetrace"] = True

cuda_bindings/cuda/bindings/_lib/windll.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cdef extern from "windows.h" nogil:
1414
ctypedef const char *LPCSTR
1515
ctypedef int BOOL
1616

17-
cdef DWORD LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800
17+
const DWORD LOAD_LIBRARY_SEARCH_SYSTEM32
1818

1919
HMODULE _LoadLibraryExW "LoadLibraryExW"(
2020
LPCWSTR lpLibFileName,

0 commit comments

Comments
 (0)