changeset 40939:8d9f366b7f19 stable

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.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 15 Dec 2018 13:54:37 -0500
parents 9ae4aed27930
children 120ecb17242b
files mercurial/vfs.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/vfs.py	Sat Dec 15 13:41:34 2018 -0500
+++ b/mercurial/vfs.py	Sat Dec 15 13:54:37 2018 -0500
@@ -518,7 +518,8 @@
         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)))