mercurial/cffi/mpatchbuild.py
changeset 36948 0585337ea787
parent 32506 2dcb3d52ef41
child 43076 2372284d9457
--- a/mercurial/cffi/mpatchbuild.py	Wed Mar 14 11:16:45 2018 -0700
+++ b/mercurial/cffi/mpatchbuild.py	Wed Mar 14 15:39:28 2018 -0400
@@ -6,8 +6,9 @@
 ffi = cffi.FFI()
 mpatch_c = os.path.join(os.path.join(os.path.dirname(__file__), '..',
                                      'mpatch.c'))
-ffi.set_source("mercurial.cffi._mpatch", open(mpatch_c).read(),
-               include_dirs=["mercurial"])
+with open(mpatch_c) as f:
+    ffi.set_source("mercurial.cffi._mpatch", f.read(),
+                   include_dirs=["mercurial"])
 ffi.cdef("""
 
 struct mpatch_frag {