]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
pybind/rados: fix application metadata list 26067/head
authorrunsisi <luo.runbing@zte.com.cn>
Tue, 22 Jan 2019 02:21:40 +0000 (10:21 +0800)
committerrunsisi <luo.runbing@zte.com.cn>
Tue, 22 Jan 2019 02:21:40 +0000 (10:21 +0800)
otherwise if we set metadata to [('k1', 'v1'), ('k2', ''), ('k3', 'v3')],
we will get the following:

[('k1', 'v1'), ('k2', 'v3')]

Signed-off-by: runsisi <luo.runbing@zte.com.cn>
src/pybind/rados/rados.pyx

index f65b10d01389dec685076bcbf7182021e5d3b999..9456f9538e40c40b663921d1b906053bd91456ab 100644 (file)
@@ -3870,10 +3870,10 @@ returned %d, but should return zero on success." % (self.name, ret))
                                                           c_vals, &val_length)
                 if ret == 0:
                     keys = [decode_cstr(key) for key in
-                                c_keys[:key_length].split(b'\0') if key]
+                                c_keys[:key_length].split(b'\0')]
                     vals = [decode_cstr(val) for val in
-                                c_vals[:val_length].split(b'\0') if val]
-                    return zip(keys, vals)
+                                c_vals[:val_length].split(b'\0')]
+                    return zip(keys, vals)[:-1]
                 elif ret == -errno.ERANGE:
                     pass
                 else: