diff hglib/client.py @ 145:f3c430afa598

hglib: abstract out use of cStringIO.StringIO (issue4520) The cStringIO module does not exist in Python 3, but io.BytesIO does. This change prepares for the use of io.BytesIO when available by replacing all uses of cStringIO.StringIO with an object named BytesIO.
author Brett Cannon <brett@python.org>
date Fri, 13 Mar 2015 11:31:54 -0400
parents fe74d5599539
children 8d7bf729a4db
line wrap: on
line diff
--- a/hglib/client.py	Wed Mar 11 14:53:36 2015 -0500
+++ b/hglib/client.py	Fri Mar 13 11:31:54 2015 -0400
@@ -1,4 +1,5 @@
-import subprocess, os, struct, cStringIO, re, datetime
+import subprocess, os, struct, re, datetime
+from cStringIO import StringIO as BytesIO
 import hglib, error, util, templates, merge, context
 
 from util import b, cmdbuilder
@@ -162,7 +163,7 @@
         input is used to reply to bulk data requests by the server
         It receives the max number of bytes to return
         """
-        out, err = cStringIO.StringIO(), cStringIO.StringIO()
+        out, err = BytesIO(), BytesIO()
         outchannels = {b('o') : out.write, b('e') : err.write}
 
         inchannels = {}