From: Kefu Chai Date: Sat, 23 Feb 2019 14:26:48 +0000 (+0800) Subject: pybind: encode flattened dict X-Git-Tag: v15.0.0~160^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F26607%2Fhead;p=ceph.git pybind: encode flattened dict in python3, the keys and values in dict are unicode strings, so we need to encode them before passing them to underlying librados' C API. Signed-off-by: Kefu Chai --- diff --git a/src/pybind/rados/rados.pyx b/src/pybind/rados/rados.pyx index 3751e8332e7..247bc4866a1 100644 --- a/src/pybind/rados/rados.pyx +++ b/src/pybind/rados/rados.pyx @@ -558,7 +558,7 @@ def decode_cstr(val, encoding="utf-8"): def flatten_dict(d): items = chain.from_iterable(d.items()) - return ''.join(i + '\0' for i in items) + return cstr(''.join(i + '\0' for i in items)) cdef char* opt_str(s) except? NULL: