Skip to content

Commit

Permalink
Merge 06ef25e into e477a6b
Browse files Browse the repository at this point in the history
  • Loading branch information
jakirkham committed Nov 23, 2018
2 parents e477a6b + 06ef25e commit 49ea913
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/cybuffer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ include "version.pxi"
cdef extern from "Python.h":
size_t Py_UNICODE_SIZE

object PyMemoryView_FromObject(object obj)


cdef extern from *:
"""
Expand Down Expand Up @@ -145,8 +143,7 @@ cdef class cybuffer(object):
else:
raise TypeError("Unable to get buffer protocol API for `data`.")

# Create a buffer based on memoryview
data_buf = PyMemoryView_FromObject(data_buf)
# Fill out our buffer based on the data
cpython.buffer.PyObject_GetBuffer(data_buf, &self._buf, PyBUF_FULL_RO)

# Allocate and/or initialize metadata for casting
Expand All @@ -155,7 +152,7 @@ cdef class cybuffer(object):
self._shape = self._buf.shape
self._strides = self._buf.strides

# Figure out whether the memoryview is contiguous
# Figure out whether the data is contiguous
self.c_contiguous = cpython.buffer.PyBuffer_IsContiguous(
&self._buf, b'C'
)
Expand Down

0 comments on commit 49ea913

Please sign in to comment.