[PATCH 4 of 8] py3: have pycompat.ospathsep and pycompat.ossep

Pulkit Goyal 7895pulkit at gmail.com
Sat Nov 5 19:16:21 EDT 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1478384084 -19800
#      Sun Nov 06 03:44:44 2016 +0530
# Node ID 95b462cda94a4cf9c399a3f3bae348923855542d
# Parent  20ee6f9c56233f7c43ce73d6d976ef6817fb0695
py3: have pycompat.ospathsep and pycompat.ossep

We needed bytes version of os.sep and os.pathsep in py3 as they return
unicodes.

diff -r 20ee6f9c5623 -r 95b462cda94a mercurial/pycompat.py
--- a/mercurial/pycompat.py	Sun Nov 06 03:33:22 2016 +0530
+++ b/mercurial/pycompat.py	Sun Nov 06 03:44:44 2016 +0530
@@ -39,6 +39,8 @@
     fsdecode = os.fsdecode
     #A bytes version of os.name.
     osname = os.name.encode('ascii')
+    ospathsep = os.pathsep.encode('ascii')
+    ossep = os.sep.encode('ascii')
 
     def sysstr(s):
         """Return a keyword str to be passed to Python functions such as
@@ -85,6 +87,8 @@
         return filename
 
     osname = os.name
+    ospathsep = os.pathsep
+    ossep = os.sep
 
 stringio = io.StringIO
 empty = _queue.Empty


More information about the Mercurial-devel mailing list