issue #477: polyfill partition() use in mitogen.ssh.

issue510
David Wilson 5 years ago
parent a48ee3a536
commit d6da84c38f

@ -40,6 +40,7 @@ except ImportError:
import mitogen.parent
from mitogen.core import b
from mitogen.core import bytes_partition
LOG = logging.getLogger('mitogen')
@ -98,12 +99,12 @@ def filter_debug(stream, it):
elif state == 'in_debug':
if b('\n') not in buf:
break
line, _, buf = buf.partition(b('\n'))
line, _, buf = bytes_partition(buf, b('\n'))
LOG.debug('%r: %s', stream,
mitogen.core.to_text(line.rstrip()))
state = 'start_of_line'
elif state == 'in_plain':
line, nl, buf = buf.partition(b('\n'))
line, nl, buf = bytes_partition(buf, b('\n'))
yield line + nl, not (nl or buf)
if nl:
state = 'start_of_line'

Loading…
Cancel
Save