From: Kefu Chai Date: Tue, 22 Oct 2019 04:42:06 +0000 (+0800) Subject: pybind/rados: do not slice zip() X-Git-Tag: v15.1.0~1189^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c039d776616f644c42d8cdb6b6083c75c6d8e6ee;p=ceph-ci.git pybind/rados: do not slice zip() in python2, zip() returns a list. while in python3, zip() returns an iterator. so we cannot slice the return value of zip(...) anymore. let's just materialized the iterator before slicing it. this change address the failure of ``` ERROR: test_rados.TestIoctx.test_applications ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python3/dist-packages/nose/case.py", line 197, in runTest self.test(*self.arg) File "/var/ssd/ceph/src/test/pybind/test_rados.py", line 879, in test_applications eq([], self.ioctx.application_metadata_list("app1")) File "rados.pyx", line 4074, in rados.Ioctx.application_metadata_list TypeError: 'zip' object is unsliceable ``` Signed-off-by: Kefu Chai --- diff --git a/src/pybind/rados/rados.pyx b/src/pybind/rados/rados.pyx index 6f4828b0be9..8dc9f7e2dc6 100644 --- a/src/pybind/rados/rados.pyx +++ b/src/pybind/rados/rados.pyx @@ -4071,7 +4071,7 @@ returned %d, but should return zero on success." % (self.name, ret)) c_keys[:key_length].split(b'\0')] vals = [decode_cstr(val) for val in c_vals[:val_length].split(b'\0')] - return zip(keys, vals)[:-1] + return list(zip(keys, vals))[:-1] elif ret == -errno.ERANGE: pass else: