mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-06-18 02:56:39 +00:00
Use flush() only if it exists (#1227)
This commit is contained in:
parent
0ced884aa3
commit
c4c263a85b
@ -439,7 +439,10 @@ class DownloadMethods:
|
|||||||
if inspect.isawaitable(r):
|
if inspect.isawaitable(r):
|
||||||
await r
|
await r
|
||||||
|
|
||||||
|
# Not all IO objects have flush (see #1227)
|
||||||
|
if callable(getattr(f, 'flush', None)):
|
||||||
f.flush()
|
f.flush()
|
||||||
|
|
||||||
if in_memory:
|
if in_memory:
|
||||||
return f.getvalue()
|
return f.getvalue()
|
||||||
finally:
|
finally:
|
||||||
|
Loading…
Reference in New Issue
Block a user