Skip to content

Commit 12653f2

Browse files
rwgkcursoragent
andcommitted
Fix: Use py::ssize_t instead of ssize_t in span tests
On Windows/MSVC, ssize_t is not available in the standard namespace without proper includes. Use py::ssize_t (the pybind11 typedef) instead to ensure cross-platform compatibility. Fixes compilation errors on: - Windows/MSVC 2022 (C++20) - GCC 10 (C++20) Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent e9de405 commit 12653f2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tests/test_numpy_array.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,11 @@ TEST_SUBMODULE(numpy_array, sm) {
251251
// test_shape_strides_span
252252
sm.def("shape_span", [](const arr &a) {
253253
auto span = a.shape_span();
254-
return std::vector<ssize_t>(span.begin(), span.end());
254+
return std::vector<py::ssize_t>(span.begin(), span.end());
255255
});
256256
sm.def("strides_span", [](const arr &a) {
257257
auto span = a.strides_span();
258-
return std::vector<ssize_t>(span.begin(), span.end());
258+
return std::vector<py::ssize_t>(span.begin(), span.end());
259259
});
260260
// Test that spans can be used to construct new arrays
261261
sm.def("array_from_spans", [](const arr &a) {

0 commit comments

Comments
 (0)