17b94a
From 4a04e1b5540921db22f1894f71eb30342127192d Mon Sep 17 00:00:00 2001
17b94a
From: Kotresh HR <khiremat@redhat.com>
17b94a
Date: Tue, 12 Nov 2019 21:53:20 +0530
17b94a
Subject: [PATCH 315/316] geo-rep: Fix py2/py3 compatibility in repce
17b94a
17b94a
Geo-rep fails to start on python2 only machine like
17b94a
centos6. It fails with "ImportError no module named _io".
17b94a
This patch fixes the same.
17b94a
17b94a
Backport of:
17b94a
 > Patch: https://review.gluster.org/23702
17b94a
 > fixes: bz#1771577
17b94a
 > Change-Id: I8228458a853a230546f9faf29a0e9e0f23b3efec
17b94a
 > Signed-off-by: Kotresh HR <khiremat@redhat.com>
17b94a
17b94a
BUG: 1771524
17b94a
Change-Id: I8228458a853a230546f9faf29a0e9e0f23b3efec
17b94a
Signed-off-by: Kotresh HR <khiremat@redhat.com>
17b94a
Reviewed-on: https://code.engineering.redhat.com/gerrit/185377
17b94a
Tested-by: RHGS Build Bot <nigelb@redhat.com>
17b94a
Reviewed-by: Sunny Kumar <sunkumar@redhat.com>
17b94a
---
17b94a
 geo-replication/syncdaemon/repce.py | 5 ++---
17b94a
 1 file changed, 2 insertions(+), 3 deletions(-)
17b94a
17b94a
diff --git a/geo-replication/syncdaemon/repce.py b/geo-replication/syncdaemon/repce.py
17b94a
index 6065b82..c622afa 100644
17b94a
--- a/geo-replication/syncdaemon/repce.py
17b94a
+++ b/geo-replication/syncdaemon/repce.py
17b94a
@@ -8,7 +8,6 @@
17b94a
 # cases as published by the Free Software Foundation.
17b94a
 #
17b94a
 
17b94a
-import _io
17b94a
 import os
17b94a
 import sys
17b94a
 import time
17b94a
@@ -58,9 +57,9 @@ def recv(inf):
17b94a
     """load an object from input stream
17b94a
     python2 and python3 compatibility, inf is sys.stdin
17b94a
     and is opened as text stream by default. Hence using the
17b94a
-    buffer attribute
17b94a
+    buffer attribute in python3
17b94a
     """
17b94a
-    if isinstance(inf, _io.TextIOWrapper):
17b94a
+    if hasattr(inf, "buffer"):
17b94a
         return pickle.load(inf.buffer)
17b94a
     else:
17b94a
         return pickle.load(inf)
17b94a
-- 
17b94a
1.8.3.1
17b94a