py3: Fix encoding and use sys.stdin.buffer
* exc.py: Encode body in response before calling replace over it. * http.py: prepend the bytes literal to the empty string or else we hit bug 1342080 again in python 3. * utils.py: Use sys.stdin.buffer in python 3. Change-Id: Ieefb8c633658e507486438e5518c5d53e819027d
This commit is contained in:
@@ -360,9 +360,12 @@ def get_data_file(args):
|
||||
return None
|
||||
if not sys.stdin.isatty():
|
||||
# (2) image data is provided through standard input
|
||||
image = sys.stdin
|
||||
if hasattr(sys.stdin, 'buffer'):
|
||||
image = sys.stdin.buffer
|
||||
if msvcrt:
|
||||
msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
|
||||
return sys.stdin
|
||||
msvcrt.setmode(image.fileno(), os.O_BINARY)
|
||||
return image
|
||||
else:
|
||||
# (3) no image data provided
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user