mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
Add tempfile deletion in case of asyncio task cancellation. (#1080)
This commit is contained in:
parent
81895d74c7
commit
468ebf50cf
1 changed files with 6 additions and 0 deletions
|
|
@ -737,6 +737,12 @@ class Client(Methods):
|
||||||
os.remove(file.name)
|
os.remove(file.name)
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
except asyncio.CancelledError:
|
||||||
|
if not in_memory:
|
||||||
|
file.close()
|
||||||
|
os.remove(file.name)
|
||||||
|
|
||||||
|
raise asyncio.CancelledError()
|
||||||
else:
|
else:
|
||||||
if in_memory:
|
if in_memory:
|
||||||
file.name = file_name
|
file.name = file_name
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue