From: Kefu Chai Date: Fri, 22 Mar 2019 06:25:12 +0000 (+0800) Subject: pybind/rados: should pass "name" to cstr() X-Git-Tag: v15.0.0~123^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F27111%2Fhead;p=ceph.git pybind/rados: should pass "name" to cstr() it's a regression introduced by 6cb23f9c Signed-off-by: Kefu Chai --- diff --git a/src/pybind/rados/rados.pyx b/src/pybind/rados/rados.pyx index 9100c086eaa4..24da79c86cd1 100644 --- a/src/pybind/rados/rados.pyx +++ b/src/pybind/rados/rados.pyx @@ -556,9 +556,9 @@ def decode_cstr(val, encoding="utf-8"): return val.decode(encoding) -def flatten_dict(d): +def flatten_dict(d, name): items = chain.from_iterable(d.items()) - return cstr(''.join(i + '\0' for i in items)) + return cstr(''.join(i + '\0' for i in items), name) cdef char* opt_str(s) except? NULL: @@ -1532,7 +1532,7 @@ Rados object in state %s." % self.state) """ service = cstr(service, 'service') daemon = cstr(daemon, 'daemon') - metadata_dict = flatten_dict(metadata) + metadata_dict = flatten_dict(metadata, 'metadata') cdef: char *_service = service char *_daemon = daemon @@ -1545,7 +1545,7 @@ Rados object in state %s." % self.state) @requires(('metadata', dict)) def service_daemon_update(self, status): - status_dict = flatten_dict(status) + status_dict = flatten_dict(status, 'status') cdef: char *_status = status_dict