Skip to content

Commit

Permalink
Use int type for size in memoryview of spectrum buffer
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mpokorny committed Mar 28, 2018
1 parent cce2e73 commit 45200ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions py/cy_vysmaw.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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 <float[:n]>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 = \
<float[:n]>self._c_message[0].content.valid_buffer.spectrum
return result

cdef class IdFailureMessage(Message):

Expand Down

0 comments on commit 45200ef

Please sign in to comment.