From 376c42f8d92500b5c48842446bbab3aab043414e Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Fri, 26 Apr 2024 01:07:30 +0000 Subject: [PATCH 1/2] Only use functions in the limited API --- python/rmm/rmm/_lib/device_buffer.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/rmm/rmm/_lib/device_buffer.pyx b/python/rmm/rmm/_lib/device_buffer.pyx index 3ce10c5f6..35d007ae9 100644 --- a/python/rmm/rmm/_lib/device_buffer.pyx +++ b/python/rmm/rmm/_lib/device_buffer.pyx @@ -14,7 +14,7 @@ import numpy as np cimport cython -from cpython.bytes cimport PyBytes_AS_STRING, PyBytes_FromStringAndSize +from cpython.bytes cimport PyBytes_AsString, PyBytes_FromStringAndSize from libc.stdint cimport uintptr_t from libcpp.memory cimport unique_ptr from libcpp.utility cimport move @@ -314,7 +314,7 @@ cdef class DeviceBuffer: cdef size_t s = dbp.size() cdef bytes b = PyBytes_FromStringAndSize(NULL, s) - cdef unsigned char* p = PyBytes_AS_STRING(b) + cdef unsigned char* p = PyBytes_AsString(b) cdef unsigned char[::1] mv = (p)[:s] self.copy_to_host(mv, stream) From 26839e39b442deab0d33938e5ab017bb1f916ba2 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Tue, 30 Apr 2024 14:51:38 -0700 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: jakirkham --- python/rmm/rmm/_lib/device_buffer.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/rmm/rmm/_lib/device_buffer.pyx b/python/rmm/rmm/_lib/device_buffer.pyx index 35d007ae9..bbeaa614e 100644 --- a/python/rmm/rmm/_lib/device_buffer.pyx +++ b/python/rmm/rmm/_lib/device_buffer.pyx @@ -14,7 +14,7 @@ import numpy as np cimport cython -from cpython.bytes cimport PyBytes_AsString, PyBytes_FromStringAndSize +from cpython.bytes cimport PyBytes_FromStringAndSize from libc.stdint cimport uintptr_t from libcpp.memory cimport unique_ptr from libcpp.utility cimport move @@ -314,7 +314,7 @@ cdef class DeviceBuffer: cdef size_t s = dbp.size() cdef bytes b = PyBytes_FromStringAndSize(NULL, s) - cdef unsigned char* p = PyBytes_AsString(b) + cdef unsigned char* p = b cdef unsigned char[::1] mv = (p)[:s] self.copy_to_host(mv, stream)