8556: ValueError: underlying buffer has been detached

The expat parser requires a binary mode file object.
This commit is contained in:
Nick Hall 2015-12-31 18:03:53 +00:00
parent cf5d9e183a
commit a1b30a5f7e

View File

@ -428,7 +428,7 @@ class ImportOpenFileContextManager:
def __enter__(self): def __enter__(self):
if self.filename == '-': if self.filename == '-':
self.filehandle = sys.stdin self.filehandle = sys.stdin.buffer
else: else:
self.filehandle = self.open_file(self.filename) self.filehandle = self.open_file(self.filename)
return self.filehandle return self.filehandle