pycompat: add util.stringio to handle py3 divergence
authortimeless <timeless@mozdev.org>
Wed, 06 Apr 2016 20:31:31 +0000
changeset 28835 68a946e83188
parent 28834 2fac032c1269
child 28836 3f45488d70df
pycompat: add util.stringio to handle py3 divergence util.stringio = cStringIO.StringIO / io.StringIO
mercurial/pycompat.py
mercurial/util.py
--- a/mercurial/pycompat.py	Wed Apr 06 22:35:52 2016 +0000
+++ b/mercurial/pycompat.py	Wed Apr 06 20:31:31 2016 +0000
@@ -11,6 +11,13 @@
 from __future__ import absolute_import
 
 try:
+    import cStringIO as io
+    stringio = io.StringIO
+except ImportError:
+    import io
+    stringio = io.StringIO
+
+try:
     import Queue as _queue
     _queue.Queue
 except ImportError:
--- a/mercurial/util.py	Wed Apr 06 22:35:52 2016 +0000
+++ b/mercurial/util.py	Wed Apr 06 20:31:31 2016 +0000
@@ -49,6 +49,7 @@
 for attr in (
     'empty',
     'queue',
+    'stringio',
 ):
     globals()[attr] = getattr(pycompat, attr)