Skip to content

Commit

Permalink
pythongh-128731: Fix ResourceWarning in robotparser.RobotFileParser.r…
Browse files Browse the repository at this point in the history
…ead() (pythonGH-128733)

(cherry picked from commit 5e65a1a)

Co-authored-by: Serhiy Storchaka <[email protected]>
  • Loading branch information
serhiy-storchaka authored and miss-islington committed Jan 12, 2025
1 parent c20c551 commit d8c2a2c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions 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
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix :exc:`ResourceWarning` in :meth:`urllib.robotparser.RobotFileParser.read`.

0 comments on commit d8c2a2c

Please sign in to comment.