# HG changeset patch # User Matt Harbison # Date 2018-12-15 18:54:37 # Node ID 8d9f366b7f199c690c048f0c77a65cff4fc9bf47 # Parent 9ae4aed27930c5d16a57920391ef3982f2222212 vfs: ensure closewrapbase fh doesn't escape by entering context manager I'm not sure if there's a problem in practice here, as there's no test failure either way. The __exit__() and close() methods raise an exception, so maybe __exit__() and close() are being called directly on the underlying handle when delayclosedfile is used on a context manager? I doubt that was intended. diff --git a/mercurial/vfs.py b/mercurial/vfs.py --- a/mercurial/vfs.py +++ b/mercurial/vfs.py @@ -518,7 +518,8 @@ class closewrapbase(object): return delattr(self._origfh, attr) def __enter__(self): - return self._origfh.__enter__() + self._origfh.__enter__() + return self def __exit__(self, exc_type, exc_value, exc_tb): raise NotImplementedError('attempted instantiating ' + str(type(self)))