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