mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
[3.13] gh-128731: Explicitly close socket on error in robotparser.RobotFileParser.read() (GH-128733) (GH-128755)
(cherry picked from commit 5e65a1acc0
)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
b1065767b4
commit
a868628836
1 changed files with 1 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