mercurial/encoding.py
changeset 33852 f18b11534274
parent 33839 7d5bc0e5b88f
child 33924 b9101467d88b
--- a/mercurial/encoding.py	Sun Aug 13 14:12:28 2017 +0900
+++ b/mercurial/encoding.py	Wed Aug 16 13:50:11 2017 +0900
@@ -575,15 +575,17 @@
         r += c
     return r
 
-class strio(io.TextIOWrapper):
-    """Wrapper around TextIOWrapper that respects hg's encoding assumptions.
+if pycompat.ispy3:
+    class strio(io.TextIOWrapper):
+        """Wrapper around TextIOWrapper that respects hg's encoding assumptions.
 
-    Also works around Python closing streams.
-    """
+        Also works around Python closing streams.
+        """
 
-    def __init__(self, buffer, **kwargs):
-        kwargs[r'encoding'] = _sysstr(encoding)
-        super(strio, self).__init__(buffer, **kwargs)
+        def __init__(self, buffer):
+            super(strio, self).__init__(buffer, encoding=_sysstr(encoding))
 
-    def __del__(self):
-        """Override __del__ so it doesn't close the underlying stream."""
+        def __del__(self):
+            """Override __del__ so it doesn't close the underlying stream."""
+else:
+    strio = pycompat.identity