#1726198: replace while 1: fp.readline() with file iteration.
diff --git a/Lib/formatter.py b/Lib/formatter.py
index fa2b389..834b560 100644
--- a/Lib/formatter.py
+++ b/Lib/formatter.py
@@ -432,10 +432,7 @@
fp = open(sys.argv[1])
else:
fp = sys.stdin
- while 1:
- line = fp.readline()
- if not line:
- break
+ for line in fp:
if line == '\n':
f.end_paragraph(1)
else:
diff --git a/Lib/keyword.py b/Lib/keyword.py
index cd1d55e..8eb2860 100755
--- a/Lib/keyword.py
+++ b/Lib/keyword.py
@@ -62,9 +62,7 @@
fp = open(iptfile)
strprog = re.compile('"([^"]+)"')
lines = []
- while 1:
- line = fp.readline()
- if not line: break
+ for line in fp:
if '{1, "' in line:
match = strprog.search(line)
if match:
diff --git a/Lib/urlparse.py b/Lib/urlparse.py
index ada6142..631a5a1 100644
--- a/Lib/urlparse.py
+++ b/Lib/urlparse.py
@@ -306,9 +306,7 @@
except ImportError:
from StringIO import StringIO
fp = StringIO(test_input)
- while 1:
- line = fp.readline()
- if not line: break
+ for line in fp:
words = line.split()
if not words:
continue