From d7e7b73006b8ca2b526111b54a5af0ee6290697a Mon Sep 17 00:00:00 2001 From: Prashanth Pai Date: Tue, 23 Jun 2015 19:45:15 +0530 Subject: 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 --- gluster/gfapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gluster') 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)) -- cgit