]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind: encode flattened dict 26607/head
authorKefu Chai <kchai@redhat.com>
Sat, 23 Feb 2019 14:26:48 +0000 (22:26 +0800)
committerKefu Chai <kchai@redhat.com>
Sat, 23 Feb 2019 14:47:03 +0000 (22:47 +0800)
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 <kchai@redhat.com>
src/pybind/rados/rados.pyx

index 3751e8332e7aab0886460a0b4403a42175654e6e..247bc4866a118e173cf7d2ecada0dc4eeac3b46a 100644 (file)
@@ -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: