mirror of
https://github.com/python/cpython.git
synced 2026-01-01 04:53:46 +00:00
[3.12] gh-128731: Explicitly close socket on error in robotparser.RobotFileParser.read() (GH-128733) (GH-128756)
(cherry picked from commit 5e65a1acc0)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
c20c551ce3
commit
b773f591a8
1 changed files with 1 additions and 0 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue