Skip to content

Commit

Permalink
Explicitly close files after upload.
Browse files Browse the repository at this point in the history
  • Loading branch information
fschulze authored and markmcclain committed Jan 8, 2024
1 parent 910c138 commit a6e86a8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions client/devpi/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,15 @@ def post(self, action, path, meta):
if self.args.dryrun:
hub.line("skipped: %s" % msg)
else:
r = hub.http.post(self.pypisubmit, dic, files=files,
headers=headers,
auth=hub.current.get_basic_auth(self.pypisubmit),
cert=hub.current.get_client_cert(self.pypisubmit))
try:
r = hub.http.post(self.pypisubmit, dic, files=files,
headers=headers,
auth=hub.current.get_basic_auth(self.pypisubmit),
cert=hub.current.get_client_cert(self.pypisubmit))
finally:
if files:
for p, f in files.values():
f.close()
hub._last_http_stati.append(r.status_code)
r = HTTPReply(r)
if r.status_code == 200:
Expand Down

0 comments on commit a6e86a8

Please sign in to comment.