diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2025-01-12 13:14:46 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-12 13:14:46 (GMT) |
commit | 5e65a1acc0b630397f1d190aed279114e6e99612 (patch) | |
tree | d2141cd4f419ed640a7c442a3ae4a28a33ede497 /Lib/urllib | |
parent | f6c61bf2d7d8b66ccd9f16e723546bdcc251a3d0 (diff) | |
download | cpython-5e65a1acc0b630397f1d190aed279114e6e99612.zip cpython-5e65a1acc0b630397f1d190aed279114e6e99612.tar.gz cpython-5e65a1acc0b630397f1d190aed279114e6e99612.tar.bz2 |
gh-128731: Fix ResourceWarning in robotparser.RobotFileParser.read() (GH-128733)
Diffstat (limited to 'Lib/urllib')
-rw-r--r-- | Lib/urllib/robotparser.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Lib/urllib/robotparser.py b/Lib/urllib/robotparser.py index c58565e..24ee198 100644 --- a/Lib/urllib/robotparser.py +++ b/Lib/urllib/robotparser.py @@ -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()) |