Skip to content

Commit

Permalink
[3.12] pythongh-128731: Explicitly close socket on error in robotpars…
Browse files Browse the repository at this point in the history
…er.RobotFileParser.read() (pythonGH-128733) (pythonGH-128756)

(cherry picked from commit 5e65a1a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
  • Loading branch information
miss-islington and serhiy-storchaka authored Jan 12, 2025
1 parent c20c551 commit b773f59
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 b773f59

Please # to comment.