pycompat: move imports of cStringIO/io to where they are used
There's no point to import cStringIO as io since we have to select StringIO
or BytesIO conditionally.
--- a/mercurial/pycompat.py Sun Mar 12 12:17:30 2017 -0700
+++ b/mercurial/pycompat.py Sun Mar 12 12:54:11 2017 -0700
@@ -19,7 +19,6 @@
if not ispy3:
import cPickle as pickle
- import cStringIO as io
import httplib
import Queue as _queue
import SocketServer as socketserver
@@ -28,7 +27,6 @@
import xmlrpclib
else:
import http.client as httplib
- import io
import pickle
import queue as _queue
import socketserver
@@ -39,6 +37,8 @@
if ispy3:
import builtins
import functools
+ import io
+
fsencode = os.fsencode
fsdecode = os.fsdecode
# A bytes version of os.name.
@@ -139,6 +139,8 @@
return [a.encode('latin-1') for a in ret]
else:
+ import cStringIO
+
bytechr = chr
def sysstr(s):
@@ -181,7 +183,7 @@
getcwd = os.getcwd
sysexecutable = sys.executable
shlexsplit = shlex.split
- stringio = io.StringIO
+ stringio = cStringIO.StringIO
empty = _queue.Empty
queue = _queue.Queue