changeset 40467:9ae4aed27930 stable

windows: ensure mixedfilemodewrapper fd doesn't escape by entering context mgr Otherwise it seems that the special read and write handling would be bypassed.
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 15 Dec 2018 13:41:34 -0500
parents e11e03f72baf
children 8d9f366b7f19
files mercurial/windows.py
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/windows.py	Sat Dec 15 01:26:18 2018 -0500
+++ b/mercurial/windows.py	Sat Dec 15 13:41:34 2018 -0500
@@ -70,7 +70,8 @@
         object.__setattr__(self, r'_lastop', 0)
 
     def __enter__(self):
-        return self._fp.__enter__()
+        self._fp.__enter__()
+        return self
 
     def __exit__(self, exc_type, exc_val, exc_tb):
         self._fp.__exit__(exc_type, exc_val, exc_tb)