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 cc6b54c5d9
commit 843795738d

View File

@ -399,7 +399,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