# HG changeset patch # User timeless # Date 2016-04-06 20:31:31 # Node ID 68a946e8318894bd95d0a5b3726006bb61fda6ad # Parent 2fac032c1269c5c59f0042a138d887fc8ea31806 pycompat: add util.stringio to handle py3 divergence util.stringio = cStringIO.StringIO / io.StringIO diff --git a/mercurial/pycompat.py b/mercurial/pycompat.py --- a/mercurial/pycompat.py +++ b/mercurial/pycompat.py @@ -11,6 +11,13 @@ This contains aliases to hide python ver 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: diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -49,6 +49,7 @@ from . import ( for attr in ( 'empty', 'queue', + 'stringio', ): globals()[attr] = getattr(pycompat, attr)