Mercurial > hg
changeset 49298:425ca3428d03
tests: constant-fold a `pycompat.ispy3` in testlib/badserverext.py
author | Manuel Jacob <me@manueljacob.de> |
---|---|
date | Tue, 31 May 2022 02:36:05 +0200 |
parents | 402f9f0f9387 |
children | 4554e2e965e2 |
files | tests/testlib/badserverext.py |
diffstat | 1 files changed, 5 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/testlib/badserverext.py Tue May 31 02:19:07 2022 +0200 +++ b/tests/testlib/badserverext.py Tue May 31 02:36:05 2022 +0200 @@ -49,7 +49,6 @@ import socket from mercurial import ( - pycompat, registrar, ) @@ -335,17 +334,13 @@ object.__getattribute__(self, '_logfp').flush() def _close(self): - # Python 3 uses an io.BufferedIO instance. Python 2 uses some file - # object wrapper. - if pycompat.ispy3: - orig = object.__getattribute__(self, '_orig') + # We wrap an io.BufferedIO instance. + orig = object.__getattribute__(self, '_orig') - if hasattr(orig, 'raw'): - orig.raw._sock.shutdown(socket.SHUT_RDWR) - else: - self.close() + if hasattr(orig, 'raw'): + orig.raw._sock.shutdown(socket.SHUT_RDWR) else: - self._sock.shutdown(socket.SHUT_RDWR) + self.close() def read(self, size=-1): cond = object.__getattribute__(self, '_cond')