summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
Diffstat (limited to 'numpy')
-rw-r--r--numpy/random/_generator.pyx4
-rw-r--r--numpy/random/mtrand.pyx4
2 files changed, 4 insertions, 4 deletions
diff --git a/numpy/random/_generator.pyx b/numpy/random/_generator.pyx
index 8db1f0269..5bacb9f6f 100644
--- a/numpy/random/_generator.pyx
+++ b/numpy/random/_generator.pyx
@@ -4441,7 +4441,7 @@ cdef class Generator:
# Fast, statically typed path: shuffle the underlying buffer.
# Only for non-empty, 1d objects of class ndarray (subclasses such
# as MaskedArrays may not support this approach).
- x_ptr = <char*><size_t>np.PyArray_DATA(x)
+ x_ptr = np.PyArray_BYTES(x)
stride = x.strides[0]
itemsize = x.dtype.itemsize
# As the array x could contain python objects we use a buffer
@@ -4449,7 +4449,7 @@ cdef class Generator:
# within the buffer and erroneously decrementing it's refcount
# when the function exits.
buf = np.empty(itemsize, dtype=np.int8) # GC'd at function exit
- buf_ptr = <char*><size_t>np.PyArray_DATA(buf)
+ buf_ptr = np.PyArray_BYTES(buf)
if x.dtype.hasobject:
with self.lock:
_shuffle_raw_wrap(&self._bitgen, n, 1, itemsize, stride,
diff --git a/numpy/random/mtrand.pyx b/numpy/random/mtrand.pyx
index c9d8ee8e3..06e75a698 100644
--- a/numpy/random/mtrand.pyx
+++ b/numpy/random/mtrand.pyx
@@ -4472,7 +4472,7 @@ cdef class RandomState:
# Fast, statically typed path: shuffle the underlying buffer.
# Only for non-empty, 1d objects of class ndarray (subclasses such
# as MaskedArrays may not support this approach).
- x_ptr = <char*><size_t>np.PyArray_DATA(x)
+ x_ptr = np.PyArray_BYTES(x)
stride = x.strides[0]
itemsize = x.dtype.itemsize
# As the array x could contain python objects we use a buffer
@@ -4480,7 +4480,7 @@ cdef class RandomState:
# within the buffer and erroneously decrementing it's refcount
# when the function exits.
buf = np.empty(itemsize, dtype=np.int8) # GC'd at function exit
- buf_ptr = <char*><size_t>np.PyArray_DATA(buf)
+ buf_ptr = np.PyArray_BYTES(buf)
with self.lock:
# We trick gcc into providing a specialized implementation for
# the most common case, yielding a ~33% performance improvement.