changeset 28835:68a946e83188

pycompat: add util.stringio to handle py3 divergence util.stringio = cStringIO.StringIO / io.StringIO
author timeless <timeless@mozdev.org>
date Wed, 06 Apr 2016 20:31:31 +0000
parents 2fac032c1269
children 3f45488d70df
files mercurial/pycompat.py mercurial/util.py
diffstat 2 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)