# HG changeset patch # User Matt Harbison # Date 2018-12-15 06:26:18 # Node ID e11e03f72baf832f4994447ee2120ac67bd0fb08 # Parent 21f5810df84864ec01ca69ec1f36ddb54b6749fe py3: ensure the proxied Windows fd doesn't escape by entering context manager The purpose of the proxy class is to provide the `name` attribute which contains the file path. But in tests that used a context manager, it still blew up complaining that 'int' doesn't have a 'startswith' function. diff --git a/mercurial/windows.py b/mercurial/windows.py --- a/mercurial/windows.py +++ b/mercurial/windows.py @@ -132,7 +132,10 @@ class fdproxy(object): self._fp = fp def __enter__(self): - return self._fp.__enter__() + self._fp.__enter__() + # Return this wrapper for the context manager so that the name is + # still available. + return self def __exit__(self, exc_type, exc_value, traceback): self._fp.__exit__(exc_type, exc_value, traceback)