Show More
@@ -575,15 +575,17 b' def fromutf8b(s):' | |||
|
575 | 575 | r += c |
|
576 | 576 | return r |
|
577 | 577 | |
|
578 | class strio(io.TextIOWrapper): | |
|
579 | """Wrapper around TextIOWrapper that respects hg's encoding assumptions. | |
|
578 | if pycompat.ispy3: | |
|
579 | class strio(io.TextIOWrapper): | |
|
580 | """Wrapper around TextIOWrapper that respects hg's encoding assumptions. | |
|
580 | 581 | |
|
581 | Also works around Python closing streams. | |
|
582 | """ | |
|
582 | Also works around Python closing streams. | |
|
583 | """ | |
|
583 | 584 | |
|
584 |
def __init__(self, buffer |
|
|
585 |
|
|
|
586 | super(strio, self).__init__(buffer, **kwargs) | |
|
585 | def __init__(self, buffer): | |
|
586 | super(strio, self).__init__(buffer, encoding=_sysstr(encoding)) | |
|
587 | 587 | |
|
588 | def __del__(self): | |
|
589 | """Override __del__ so it doesn't close the underlying stream.""" | |
|
588 | def __del__(self): | |
|
589 | """Override __del__ so it doesn't close the underlying stream.""" | |
|
590 | else: | |
|
591 | strio = pycompat.identity |
@@ -175,11 +175,10 b' def safehasattr(thing, attr):' | |||
|
175 | 175 | def bytesinput(fin, fout, *args, **kwargs): |
|
176 | 176 | sin, sout = sys.stdin, sys.stdout |
|
177 | 177 | try: |
|
178 | sys.stdin, sys.stdout = encoding.strio(fin), encoding.strio(fout) | |
|
178 | 179 | if pycompat.ispy3: |
|
179 | sys.stdin, sys.stdout = encoding.strio(fin), encoding.strio(fout) | |
|
180 | 180 | return encoding.strtolocal(input(*args, **kwargs)) |
|
181 | 181 | else: |
|
182 | sys.stdin, sys.stdout = fin, fout | |
|
183 | 182 | return raw_input(*args, **kwargs) |
|
184 | 183 | finally: |
|
185 | 184 | sys.stdin, sys.stdout = sin, sout |
General Comments 0
You need to be logged in to leave comments.
Login now