aboutsummaryrefslogtreecommitdiff
blob: a81aae6e7ce899c46faa6267d6c536b10e9fc9b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
commit 773e01294da518c6ec18f0a8b72e05def85fef6c
Author: Oleh Prypin <oleh@pryp.in>
Date:   Fri Jun 24 15:48:57 2016 +0300

    pybind: Make RBD Python bindings compatible with Python 3
    
    Signed-off-by: Oleh Prypin <oleh@pryp.in>

diff --git a/src/pybind/rbd/rbd.pyx b/src/pybind/rbd/rbd.pyx
index 52727bf39e..8f25dfbee0 100644
--- a/src/pybind/rbd/rbd.pyx
+++ b/src/pybind/rbd/rbd.pyx
@@ -745,7 +745,7 @@ class RBD(object):
                     break
                 elif ret != -errno.ERANGE:
                     raise make_ex(ret, 'error listing images')
-            return [decode_cstr(name) for name in c_names[:ret].split('\0')
+            return [decode_cstr(name) for name in c_names[:ret].split(b'\0')
                     if name]
         finally:
             free(c_names)
@@ -1885,8 +1885,8 @@ written." % (self.name, ret, length))
                     raise make_ex(ret, 'error listing images')
             if ret == 0:
                 return []
-            pools = map(decode_cstr, c_pools[:pools_size - 1].split('\0'))
-            images = map(decode_cstr, c_images[:images_size - 1].split('\0'))
+            pools = map(decode_cstr, c_pools[:pools_size - 1].split(b'\0'))
+            images = map(decode_cstr, c_images[:images_size - 1].split(b'\0'))
             return list(zip(pools, images))
         finally:
             free(c_pools)
@@ -1933,9 +1933,9 @@ written." % (self.name, ret, length))
                     raise make_ex(ret, 'error listing images')
             if ret == 0:
                 return []
-            clients = map(decode_cstr, c_clients[:clients_size - 1].split('\0'))
-            cookies = map(decode_cstr, c_cookies[:cookies_size - 1].split('\0'))
-            addrs = map(decode_cstr, c_addrs[:addrs_size - 1].split('\0'))
+            clients = map(decode_cstr, c_clients[:clients_size - 1].split(b'\0'))
+            cookies = map(decode_cstr, c_cookies[:cookies_size - 1].split(b'\0'))
+            addrs = map(decode_cstr, c_addrs[:addrs_size - 1].split(b'\0'))
             return {
                 'tag'       : decode_cstr(c_tag),
                 'exclusive' : exclusive == 1,