##// END OF EJS Templates
tests: constant-fold a `pycompat.ispy3` in testlib/badserverext.py
Manuel Jacob -
r50193:425ca342 default
parent child Browse files
Show More
@@ -49,7 +49,6 b' import re'
49 import socket
49 import socket
50
50
51 from mercurial import (
51 from mercurial import (
52 pycompat,
53 registrar,
52 registrar,
54 )
53 )
55
54
@@ -335,17 +334,13 b' class fileobjectproxy:'
335 object.__getattribute__(self, '_logfp').flush()
334 object.__getattribute__(self, '_logfp').flush()
336
335
337 def _close(self):
336 def _close(self):
338 # Python 3 uses an io.BufferedIO instance. Python 2 uses some file
337 # We wrap an io.BufferedIO instance.
339 # object wrapper.
338 orig = object.__getattribute__(self, '_orig')
340 if pycompat.ispy3:
341 orig = object.__getattribute__(self, '_orig')
342
339
343 if hasattr(orig, 'raw'):
340 if hasattr(orig, 'raw'):
344 orig.raw._sock.shutdown(socket.SHUT_RDWR)
341 orig.raw._sock.shutdown(socket.SHUT_RDWR)
345 else:
346 self.close()
347 else:
342 else:
348 self._sock.shutdown(socket.SHUT_RDWR)
343 self.close()
349
344
350 def read(self, size=-1):
345 def read(self, size=-1):
351 cond = object.__getattribute__(self, '_cond')
346 cond = object.__getattribute__(self, '_cond')
General Comments 0
You need to be logged in to leave comments. Login now