Mercurial > hg-stable
changeset 34428:a454123f5d94
keepalive: python 3 portability tweaks
Differential Revision: https://phab.mercurial-scm.org/D888
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 01 Oct 2017 12:15:53 -0400 |
parents | ae2fcf7af409 |
children | 0ee9cf8d054a |
files | mercurial/keepalive.py |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/keepalive.py Sun Oct 01 07:29:51 2017 -0400 +++ b/mercurial/keepalive.py Sun Oct 01 12:15:53 2017 -0400 @@ -92,6 +92,7 @@ from .i18n import _ from . import ( + pycompat, util, ) @@ -235,7 +236,8 @@ # The string form of BadStatusLine is the status line. Add some context # to make the error message slightly more useful. except httplib.BadStatusLine as err: - raise urlerr.urlerror(_('bad HTTP status line: %s') % err.line) + raise urlerr.urlerror( + _('bad HTTP status line: %s') % pycompat.sysbytes(err.line)) except (socket.error, httplib.HTTPException) as err: raise urlerr.urlerror(err) @@ -358,9 +360,12 @@ def __init__(self, sock, debuglevel=0, strict=0, method=None): + extrakw = {} + if not pycompat.ispy3: + extrakw['strict'] = True + extrakw['buffering'] = True httplib.HTTPResponse.__init__(self, sock, debuglevel=debuglevel, - strict=True, method=method, - buffering=True) + method=method, **extrakw) self.fileno = sock.fileno self.code = None self._rbuf = ''