mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-31 20:54:51 +00:00
Avoid calling fdopen on closed descriptor
This commit is contained in:
parent
5bc10b45a3
commit
cd0e585d0d
1 changed files with 11 additions and 0 deletions
|
|
@ -2299,6 +2299,17 @@ class Client:
|
|||
cdn_session.start()
|
||||
|
||||
try:
|
||||
# cant fdopen the closed file descriptor from above
|
||||
# which is closed due to the with statement in the branch just above
|
||||
# make a new temp file to write to
|
||||
|
||||
try:
|
||||
os.remove(file_name)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
fd, file_name = tempfile.mkstemp()
|
||||
|
||||
with os.fdopen(fd, "wb") as f:
|
||||
while True:
|
||||
r2 = cdn_session.send(
|
||||
|
|
|
|||
Loading…
Reference in a new issue