From 7a71d77d5f3af3fde386eb26f4a2bdff8012fd46 Mon Sep 17 00:00:00 2001 From: Stephan Hoyer Date: Fri, 14 Feb 2025 16:19:51 -0800 Subject: [PATCH] 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. --- include/membuf.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/membuf.pyx b/include/membuf.pyx index 21a916db4..a236a1043 100644 --- a/include/membuf.pyx +++ b/include/membuf.pyx @@ -14,7 +14,7 @@ cdef memview_fromptr(void *memory, size_t size): # private extension type that implements buffer protocol. cdef class _MemBuf: - cdef const void *memory + cdef void *memory cdef size_t size def __getbuffer__(self, Py_buffer *buf, int flags): PyBuffer_FillInfo(buf, self, self.memory, self.size, 1, flags)