From: Hector Martin Date: Wed, 9 Dec 2015 09:07:50 +0000 (+0900) Subject: pybind/rbd.pyx: PyString -> PyBytes X-Git-Tag: v10.0.2~70^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=469b55a60c70cb622db4378fab31d79c3e9722d9;p=ceph.git pybind/rbd.pyx: PyString -> PyBytes --- diff --git a/src/pybind/rbd.pyx b/src/pybind/rbd.pyx index c1a1df45ace1..df6d6879b76e 100644 --- a/src/pybind/rbd.pyx +++ b/src/pybind/rbd.pyx @@ -26,9 +26,9 @@ cdef extern from "Python.h": # PyObject*, which invokes assumptions in cpython that we need to # legitimately break to implement zero-copy string buffers in Image.read(). # This is valid use of the Python API and documented as a special case. - PyObject *PyString_FromStringAndSize(char *v, Py_ssize_t len) except NULL - char* PyString_AsString(PyObject *string) except NULL - int _PyString_Resize(PyObject **string, Py_ssize_t newsize) except -1 + PyObject *PyBytes_FromStringAndSize(char *v, Py_ssize_t len) except NULL + char* PyBytes_AsString(PyObject *string) except NULL + int _PyBytes_Resize(PyObject **string, Py_ssize_t newsize) except -1 cdef extern from "rbd/librbd.h" nogil: enum: @@ -1062,9 +1062,9 @@ cdef class Image(object): size_t _length = length int _fadvise_flags = fadvise_flags PyObject* ret_s = NULL - ret_s = PyString_FromStringAndSize(NULL, length) + ret_s = PyBytes_FromStringAndSize(NULL, length) try: - ret_buf = PyString_AsString(ret_s) + ret_buf = PyBytes_AsString(ret_s) with nogil: ret = rbd_read2(self.image, _offset, _length, ret_buf, _fadvise_flags) @@ -1072,7 +1072,7 @@ cdef class Image(object): raise make_ex(ret, 'error reading %s %ld~%ld' % (self.name, offset, length)) if ret != length: - _PyString_Resize(&ret_s, ret) + _PyBytes_Resize(&ret_s, ret) return ret_s finally: