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