From patchwork Tue Feb 27 09:47:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: D2477: py3: convert os.devnull to bytes using pycompat.bytestr From: phabricator X-Patchwork-Id: 28442 Message-Id: To: mercurial-devel@mercurial-scm.org Date: Tue, 27 Feb 2018 09:47:43 +0000 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 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