Skip to content

Commit a868628

Browse files
[3.13] gh-128731: Explicitly close socket on error in robotparser.RobotFileParser.read() (GH-128733) (GH-128755)
(cherry picked from commit 5e65a1a) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent b106576 commit a868628

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Lib/urllib/robotparser.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def read(self):
6565
self.disallow_all = True
6666
elif err.code >= 400 and err.code < 500:
6767
self.allow_all = True
68+
err.close()
6869
else:
6970
raw = f.read()
7071
self.parse(raw.decode("utf-8").splitlines())

0 commit comments

Comments
 (0)