mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +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
|
||||
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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue