equal
deleted
inserted
replaced
573 if "\xed\xb0\x80" <= c <= "\xed\xb3\xbf": |
573 if "\xed\xb0\x80" <= c <= "\xed\xb3\xbf": |
574 c = chr(ord(c.decode("utf-8")) & 0xff) |
574 c = chr(ord(c.decode("utf-8")) & 0xff) |
575 r += c |
575 r += c |
576 return r |
576 return r |
577 |
577 |
578 class strio(io.TextIOWrapper): |
578 if pycompat.ispy3: |
579 """Wrapper around TextIOWrapper that respects hg's encoding assumptions. |
579 class strio(io.TextIOWrapper): |
580 |
580 """Wrapper around TextIOWrapper that respects hg's encoding assumptions. |
581 Also works around Python closing streams. |
581 |
582 """ |
582 Also works around Python closing streams. |
583 |
583 """ |
584 def __init__(self, buffer, **kwargs): |
584 |
585 kwargs[r'encoding'] = _sysstr(encoding) |
585 def __init__(self, buffer): |
586 super(strio, self).__init__(buffer, **kwargs) |
586 super(strio, self).__init__(buffer, encoding=_sysstr(encoding)) |
587 |
587 |
588 def __del__(self): |
588 def __del__(self): |
589 """Override __del__ so it doesn't close the underlying stream.""" |
589 """Override __del__ so it doesn't close the underlying stream.""" |
|
590 else: |
|
591 strio = pycompat.identity |