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

login
register
mail settings
Submitter Pulkit Goyal
Date Nov. 5, 2016, 11:16 p.m.
Message ID <95b462cda94a4cf9c399.1478387781@pulkit-goyal>
Download mbox | patch
Permalink /patch/17356/
State Accepted
Headers show

Comments

Pulkit Goyal - Nov. 5, 2016, 11:16 p.m.
# HG changeset patch
# User Pulkit Goyal <7895pulkit@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.

Patch

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