Submitter | Gregory Szorc |
---|---|
Date | Jan. 3, 2016, 12:45 a.m. |
Message ID | <3481c6e7a3ee0816aa6f.1451781930@ubuntu-vm-main> |
Download | mbox | patch |
Permalink | /patch/12496/ |
State | Accepted |
Delegated to: | Matt Mackall |
Headers | show |
Comments
Patch
diff --git a/mercurial/pure/osutil.py b/mercurial/pure/osutil.py --- a/mercurial/pure/osutil.py +++ b/mercurial/pure/osutil.py @@ -249,8 +249,14 @@ else: return getattr(self._file, name) def __setattr__(self, name, value): '''mimics the read-only attributes of Python file objects by raising 'TypeError: readonly attribute' if someone tries: f = posixfile('foo.txt') f.name = 'bla' ''' return self._file.__setattr__(name, value) + + def __enter__(self): + return self._file.__enter__() + + def __exit__(self, exc_type, exc_value, exc_tb): + return self._file.__exit__(exc_type, exc_value, exc_tb)