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)
  • Loading branch information
serhiy-storchaka authored Jan 12, 2025
1 parent f6c61bf commit 5e65a1a
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 5e65a1a

Please sign in to comment.