# HG changeset patch # User Gregory Szorc # Date 1518393511 28800 # Node ID bff95b002e33652a3b69f3fb7319ce7df5d75b30 # Parent c33a99506e13fb5278f040d5ce56cdc09c8fa5b6 py3: open patches.queue in binary mode And switch to using the context manager form of open() while we're here. Differential Revision: https://phab.mercurial-scm.org/D2153 diff -r c33a99506e13 -r bff95b002e33 hgext/mq.py --- a/hgext/mq.py Sun Feb 11 15:55:47 2018 -0800 +++ b/hgext/mq.py Sun Feb 11 15:58:31 2018 -0800 @@ -445,9 +445,9 @@ def __init__(self, ui, baseui, path, patchdir=None): self.basepath = path try: - fh = open(os.path.join(path, 'patches.queue')) - cur = fh.read().rstrip() - fh.close() + with open(os.path.join(path, 'patches.queue'), r'rb') as fh: + cur = fh.read().rstrip() + if not cur: curpath = os.path.join(path, 'patches') else: