summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2008-07-12 23:41:19 (GMT)
committerBenjamin Peterson <benjamin@python.org>2008-07-12 23:41:19 (GMT)
commit0522a9f1eba72a7fdb6b5b6065872654f1d6becc (patch)
treea7c3b777dc64f6216078456ac21c97e058224512
parent24122593f07fe756aa5c9a5db908ae4f5d22f352 (diff)
downloadcpython-0522a9f1eba72a7fdb6b5b6065872654f1d6becc.zip
cpython-0522a9f1eba72a7fdb6b5b6065872654f1d6becc.tar.gz
cpython-0522a9f1eba72a7fdb6b5b6065872654f1d6becc.tar.bz2
#1778443 robotparser fixes from Aristotelis Mikropoulos
-rw-r--r--Lib/robotparser.py9
-rw-r--r--Misc/ACKS1
2 files changed, 4 insertions, 6 deletions
diff --git a/Lib/robotparser.py b/Lib/robotparser.py
index 5b1d797..f249187 100644
--- a/Lib/robotparser.py
+++ b/Lib/robotparser.py
@@ -55,11 +55,8 @@ class RobotFileParser:
"""Reads the robots.txt URL and feeds it to the parser."""
opener = URLopener()
f = opener.open(self.url)
- lines = []
- line = f.readline()
- while line:
- lines.append(line.strip())
- line = f.readline()
+ lines = [line.strip() for line in f]
+ f.close()
self.errcode = opener.errcode
if self.errcode in (401, 403):
self.disallow_all = True
@@ -84,7 +81,7 @@ class RobotFileParser:
entry = Entry()
for line in lines:
- linenumber = linenumber + 1
+ linenumber += 1
if not line:
if state == 1:
entry = Entry()
diff --git a/Misc/ACKS b/Misc/ACKS
index e79f20a..ac445ae 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -460,6 +460,7 @@ Luke Mewburn
Mike Meyer
Steven Miale
Trent Mick
+Aristotelis Mikropoulos
Damien Miller
Chad Miller
Jay T. Miller