changeset 36107:bff95b002e33

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
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 11 Feb 2018 15:58:31 -0800
parents c33a99506e13
children c4146cf4dd20
files hgext/mq.py
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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: