Skip to content

Commit 5314521

Browse files
flexatoneCopilot
andauthored
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 1d6bf22 commit 5314521

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/methods.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,10 @@ write_array_to_file(PyObject *Py_UNUSED(m), PyObject *args, PyObject *kwargs)
11651165
npy_intp *strideptr = NpyIter_GetInnerStrideArray(iter);
11661166
npy_intp *innersizeptr = NpyIter_GetInnerLoopSizePtr(iter);
11671167
Py_ssize_t itemsize = PyArray_ITEMSIZE(array);
1168+
if (itemsize == 0) {
1169+
NpyIter_Deallocate(iter);
1170+
Py_RETURN_NONE;
1171+
}
11681172
PyObject *write_name = PyUnicode_InternFromString("write");
11691173
if (write_name == NULL) {
11701174
NpyIter_Deallocate(iter);

0 commit comments

Comments
 (0)