Skip to content

Commit

Permalink
[3.13] gh-128731: Explicitly close socket on error in robotparser.Rob…
Browse files Browse the repository at this point in the history
…otFileParser.read() (GH-128733) (GH-128755)

(cherry picked from commit 5e65a1a)

Co-authored-by: Serhiy Storchaka <[email protected]>
  • Loading branch information
miss-islington and serhiy-storchaka authored Jan 13, 2025
1 parent b106576 commit a868628
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Lib/urllib/robotparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def read(self):
self.disallow_all = True
elif err.code >= 400 and err.code < 500:
self.allow_all = True
err.close()
else:
raw = f.read()
self.parse(raw.decode("utf-8").splitlines())
Expand Down

0 comments on commit a868628

Please sign in to comment.