Use flush() only if it exists (#1227)

This commit is contained in:
st7105
2019-07-09 11:40:05 +02:00
committed by Lonami
parent 0ced884aa3
commit c4c263a85b
+4 -1
View File
@@ -439,7 +439,10 @@ class DownloadMethods:
if inspect.isawaitable(r):
await r
f.flush()
# Not all IO objects have flush (see #1227)
if callable(getattr(f, 'flush', None)):
f.flush()
if in_memory:
return f.getvalue()
finally: