From: Kefu Chai Date: Tue, 1 Sep 2020 12:38:46 +0000 (+0800) Subject: pybind: s/unicode/str/ X-Git-Tag: v16.1.0~1112^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=159858b0495b88247bf6b988bd6bd81ef77437a2;p=ceph.git pybind: s/unicode/str/ we've migrated to python3, so no "unicode" anymore. Signed-off-by: Kefu Chai --- diff --git a/src/pybind/cephfs/cephfs.pyx b/src/pybind/cephfs/cephfs.pyx index d541e00ef6917..c40c2eb060028 100644 --- a/src/pybind/cephfs/cephfs.pyx +++ b/src/pybind/cephfs/cephfs.pyx @@ -508,7 +508,7 @@ def decode_cstr(val, encoding="utf-8"): Decode a byte string into a Python string. :param bytes val: byte string - :rtype: unicode or None + :rtype: str or None """ if val is None: return None diff --git a/src/pybind/rados/rados.pyx b/src/pybind/rados/rados.pyx index aead26ee0ae93..9089dc32ace82 100644 --- a/src/pybind/rados/rados.pyx +++ b/src/pybind/rados/rados.pyx @@ -565,7 +565,7 @@ def cstr(val, name, encoding="utf-8", opt=False): return None if isinstance(val, bytes): return val - elif isinstance(val, unicode): + elif isinstance(val, str): return val.encode(encoding) else: raise TypeError('%s must be a string' % name) @@ -580,7 +580,7 @@ def decode_cstr(val, encoding="utf-8"): Decode a byte string into a Python string. :param bytes val: byte string - :rtype: unicode or None + :rtype: str or None """ if val is None: return None diff --git a/src/pybind/rbd/rbd.pyx b/src/pybind/rbd/rbd.pyx index 6fd4783711b34..8b7d5403c11a5 100644 --- a/src/pybind/rbd/rbd.pyx +++ b/src/pybind/rbd/rbd.pyx @@ -1050,7 +1050,7 @@ def decode_cstr(val, encoding="utf-8"): Decode a byte string into a Python string. :param bytes val: byte string - :rtype: unicode or None + :rtype: str or None """ if val is None: return None diff --git a/src/pybind/rgw/rgw.pyx b/src/pybind/rgw/rgw.pyx index d5db7f5d93c62..6e85dd718f549 100644 --- a/src/pybind/rgw/rgw.pyx +++ b/src/pybind/rgw/rgw.pyx @@ -292,7 +292,7 @@ def cstr(val, name, encoding="utf-8", opt=False): return None if isinstance(val, bytes): return val - elif isinstance(val, unicode): + elif isinstance(val, str): return val.encode(encoding) else: raise TypeError('%s must be a string' % name)