windows: ensure pure posixfile fd doesn't escape by entering context manager stable
authorMatt Harbison <matt_harbison@yahoo.com>
Sat, 15 Dec 2018 14:55:06 -0500
branchstable
changeset 40940 120ecb17242b
parent 40939 8d9f366b7f19
child 40986 328557af18eb
windows: ensure pure posixfile fd doesn't escape by entering context manager There are tests in test-revlog-mmapindex.t and test-rebase-mq-skip.t that are fixed by this, but we usually don't use --pure on Windows. For whatever reason, the remaining --pure failures are various errors like $ENOTDIR$ and "Access is denied" have a trailing '.'.
mercurial/pure/osutil.py
--- a/mercurial/pure/osutil.py	Sat Dec 15 13:54:37 2018 -0500
+++ b/mercurial/pure/osutil.py	Sat Dec 15 14:55:06 2018 -0500
@@ -267,7 +267,8 @@
             return self._file.__setattr__(name, value)
 
         def __enter__(self):
-            return self._file.__enter__()
+            self._file.__enter__()
+            return self
 
         def __exit__(self, exc_type, exc_value, exc_tb):
             return self._file.__exit__(exc_type, exc_value, exc_tb)