gh-128731: Fix ResourceWarning in robotparser.RobotFileParser.read() (GH-128733)

This commit is contained in:
Serhiy Storchaka 2025-01-12 15:14:46 +02:00 committed by GitHub
parent f6c61bf2d7
commit 5e65a1acc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 0 deletions

View file

@ -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())