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