summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2015-06-23 19:45:15 +0530
committerPrashanth Pai <ppai@redhat.com>2015-06-23 19:45:15 +0530
commitd7e7b73006b8ca2b526111b54a5af0ee6290697a (patch)
treee39b81b047e943e9b12250875b1e1916bcb70995
parent2c468ae0d5a1e25998373abb72d87b1ee7693816 (diff)
Fix parsing of binary data as str
This change will return the raw string read as is which fixes case where arbitrary binary data (such as an array.array) is written and read back as string to be unmarshalled back as array.array This patch does not yet address writing array.array and arbitrary objects into binary files. That will be sent as a separate change. Change-Id: Ic135198cca2c0dc8e103176920056e9df0c00f2b Signed-off-by: Prashanth Pai <ppai@redhat.com>
-rwxr-xr-xgluster/gfapi.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/gluster/gfapi.py b/gluster/gfapi.py
index bd6f240..5bbb8cb 100755
--- a/gluster/gfapi.py
+++ b/gluster/gfapi.py
@@ -322,7 +322,7 @@ class File(object):
# In python 2.x, read() always returns a string. It's really upto
# the consumer to decode this string into whatever encoding it was
# written with.
- return rbuf.value[:ret]
+ return rbuf.raw[:ret]
elif ret < 0:
err = ctypes.get_errno()
raise OSError(err, os.strerror(err))