https://github.com/python/cpython/commit/b773f591a87f415e503f42e4308dcb1eaad8d3e9 commit: b773f591a87f415e503f42e4308dcb1eaad8d3e9 branch: 3.12 author: Miss Islington (bot) <[email protected]> committer: serhiy-storchaka <[email protected]> date: 2025-01-12T13:34:24Z summary:
[3.12] gh-128731: Explicitly close socket on error in robotparser.RobotFileParser.read() (GH-128733) (GH-128756) (cherry picked from commit 5e65a1acc0b630397f1d190aed279114e6e99612) Co-authored-by: Serhiy Storchaka <[email protected]> files: M Lib/urllib/robotparser.py diff --git a/Lib/urllib/robotparser.py b/Lib/urllib/robotparser.py index c58565e3945146..24ee198c355f56 100644 --- a/Lib/urllib/robotparser.py +++ b/Lib/urllib/robotparser.py @@ -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()) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: [email protected]
