From f857c227ff78b9964fc3fd414beaea6b1ed97976 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Sat, 23 Feb 2019 22:26:48 +0800 Subject: [PATCH] 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 (cherry picked from commit 6cb23f9ce6b3848a7fd93d135acc143f2ae7cba1) --- src/pybind/rados/rados.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pybind/rados/rados.pyx b/src/pybind/rados/rados.pyx index dbd150540b67d..b281ce69001be 100644 --- a/src/pybind/rados/rados.pyx +++ b/src/pybind/rados/rados.pyx @@ -559,7 +559,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: -- 2.39.5