From 45200eff1fa0e0a5286f983cb8102280745f5d02 Mon Sep 17 00:00:00 2001 From: Martin Pokorny Date: Wed, 28 Mar 2018 14:41:05 -0600 Subject: [PATCH] Use int type for size in memoryview of spectrum buffer The computation of the number of elements in a spectrum buffer has a result with type Pysize_t under python3, which the memoryview constructor doesn't like. Converting the value to an integer fixes the problem. --- py/cy_vysmaw.pyx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/py/cy_vysmaw.pyx b/py/cy_vysmaw.pyx index 0178e46..b91ae91 100644 --- a/py/cy_vysmaw.pyx +++ b/py/cy_vysmaw.pyx @@ -540,9 +540,11 @@ cdef class ValidBufferMessage(Message): @property def spectrum(self): - n = (self._c_message[0].content.valid_buffer.buffer_size - - VYS_SPECTRUM_OFFSET) / sizeof(float) - return self._c_message[0].content.valid_buffer.spectrum + n = int((self._c_message[0].content.valid_buffer.buffer_size + - VYS_SPECTRUM_OFFSET) / sizeof(float)) + cdef float[:] result = \ + self._c_message[0].content.valid_buffer.spectrum + return result cdef class IdFailureMessage(Message):