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

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Tue Feb 27 09:47:43 UTC 2018


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

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
 



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


More information about the Mercurial-devel mailing list