diff -r 3d0178bf1039 -r 0585337ea787 mercurial/cffi/mpatchbuild.py --- 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 {