Patchwork D2477: py3: convert os.devnull to bytes using pycompat.bytestr

login
register
mail settings
Submitter phabricator
Date Feb. 27, 2018, 9:47 a.m.
Message ID <differential-rev-PHID-DREV-dutfjxezzg5q5db2pb5d-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28442/
State Superseded
Headers show

Comments

phabricator - Feb. 27, 2018, 9:47 a.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  os.devnull returns str on Python 3.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2477

AFFECTED FILES
  hgext/convert/common.py
  mercurial/windows.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/windows.py b/mercurial/windows.py
--- a/mercurial/windows.py
+++ b/mercurial/windows.py
@@ -316,7 +316,7 @@ 
     # Work around "popen spawned process may not write to stdout
     # under windows"
     # http://bugs.python.org/issue1366
-    command += " 2> %s" % os.devnull
+    command += " 2> %s" % pycompat.bytestr(os.devnull)
     return os.popen(quotecommand(command), mode)
 
 def explainexit(code):
diff --git a/hgext/convert/common.py b/hgext/convert/common.py
--- a/hgext/convert/common.py
+++ b/hgext/convert/common.py
@@ -339,7 +339,7 @@ 
                 pass
         cmdline = [util.shellquote(arg) for arg in cmdline]
         if not self.ui.debugflag:
-            cmdline += ['2>', os.devnull]
+            cmdline += ['2>', pycompat.bytestr(os.devnull)]
         cmdline = ' '.join(cmdline)
         return cmdline