Skip to content

Commit 7a71d77

Browse files
committed
Fix incorrect const qualifier in membuf.pyx
Without this change, I see errors when building netCDF4-python, originating at the line `free(self.memory)` in `__dealloc__()`: .../_cython/_netCDF4.cc:12922:3: error: no matching function for call to 'free' 12922 | free(__pyx_v_self->memory); | ^~~~ .../include/stdlib.h:563:13: note: candidate function not viable: 1st argument ('const void *') would lose const qualifier 563 | extern void free (void *__ptr) __THROW; | ^ ~~~~~~~~~~~ Apparently it is not valid call `free()` on a `const` variable.
1 parent 9426a68 commit 7a71d77

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/membuf.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ cdef memview_fromptr(void *memory, size_t size):
1414

1515
# private extension type that implements buffer protocol.
1616
cdef class _MemBuf:
17-
cdef const void *memory
17+
cdef void *memory
1818
cdef size_t size
1919
def __getbuffer__(self, Py_buffer *buf, int flags):
2020
PyBuffer_FillInfo(buf, self, <void *>self.memory, self.size, 1, flags)

0 commit comments

Comments
 (0)