summaryrefslogtreecommitdiff
path: root/python/samba/compat.py
diff options
context:
space:
mode:
authorNoel Power <noel.power@suse.com>2018-04-17 13:52:58 +0100
committerNoel Power <npower@samba.org>2018-04-30 15:43:19 +0200
commitd331ddf47f7b0ee360a8c7a61e0b38d279ecbd48 (patch)
tree45c6ae225a080c595945d1c9fe1c7b2f340958f5 /python/samba/compat.py
parentd2ee36e350108a226a3d3dc641a067c9eed4897d (diff)
downloadsamba-d331ddf47f7b0ee360a8c7a61e0b38d279ecbd48.tar.gz
Add aliases for StringIO.StringIO
cStringIO doesn't handle unicode, StringIO does. With py2/py3 compatable code we can easily find ourselves getting passed unicode so we don't alias cStringIO Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Alexander Bokovoy <ab@samba.org>
Diffstat (limited to 'python/samba/compat.py')
-rw-r--r--python/samba/compat.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/python/samba/compat.py b/python/samba/compat.py
index d17dc3c2ce9..5662095fed5 100644
--- a/python/samba/compat.py
+++ b/python/samba/compat.py
@@ -30,6 +30,10 @@ if PY3:
integer_types = int,
string_types = str
text_type = str
+
+ # alias
+ import io
+ StringIO = io.StringIO
else:
# compat functions
from urllib import quote as urllib_quote
@@ -39,3 +43,7 @@ else:
integer_types = (int, long)
string_types = basestring
text_type = unicode
+
+ # alias
+ import StringIO
+ StringIO = StringIO.StringIO