mirror of
https://github.com/python/cpython.git
synced 2025-11-17 01:25:57 +00:00
gh-128731: Fix ResourceWarning in robotparser.RobotFileParser.read() (GH-128733)
This commit is contained in:
parent
f6c61bf2d7
commit
5e65a1acc0
2 changed files with 2 additions and 0 deletions
|
|
@ -65,6 +65,7 @@ class RobotFileParser:
|
||||||
self.disallow_all = True
|
self.disallow_all = True
|
||||||
elif err.code >= 400 and err.code < 500:
|
elif err.code >= 400 and err.code < 500:
|
||||||
self.allow_all = True
|
self.allow_all = True
|
||||||
|
err.close()
|
||||||
else:
|
else:
|
||||||
raw = f.read()
|
raw = f.read()
|
||||||
self.parse(raw.decode("utf-8").splitlines())
|
self.parse(raw.decode("utf-8").splitlines())
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
Fix :exc:`ResourceWarning` in :meth:`urllib.robotparser.RobotFileParser.read`.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue