[Python-3000-checkins] r55824 - in python/branches/py3k-struni: Lib/io.py runtests.sh
guido.van.rossum
python-3000-checkins at python.org
Fri Jun 8 02:08:01 CEST 2007
Author: guido.van.rossum
Date: Fri Jun 8 02:07:57 2007
New Revision: 55824
Modified:
python/branches/py3k-struni/Lib/io.py
python/branches/py3k-struni/runtests.sh
Log:
Make test_socket work.
Don't exclude test_socket from the tests to run.
Modified: python/branches/py3k-struni/Lib/io.py
==============================================================================
--- python/branches/py3k-struni/Lib/io.py (original)
+++ python/branches/py3k-struni/Lib/io.py Fri Jun 8 02:07:57 2007
@@ -300,17 +300,23 @@
def readline(self, limit: int = -1) -> bytes:
"""For backwards compatibility, a (slowish) readline()."""
+ if hasattr(self, "peek"):
+ def nreadahead():
+ readahead = self.peek(1, unsafe=True)
+ if not readahead:
+ return 1
+ n = (readahead.find(b"\n") + 1) or len(readahead)
+ if limit >= 0:
+ n = min(n, limit)
+ return n
+ else:
+ def nreadahead():
+ return 1
if limit is None:
limit = -1
res = bytes()
while limit < 0 or len(res) < limit:
- readahead = self.peek(1, unsafe=True)
- if not readahead:
- break
- n = (readahead.find(b"\n") + 1) or len(readahead)
- if limit >= 0:
- n = min(n, limit)
- b = self.read(n)
+ b = self.read(nreadahead())
if not b:
break
res += b
Modified: python/branches/py3k-struni/runtests.sh
==============================================================================
--- python/branches/py3k-struni/runtests.sh (original)
+++ python/branches/py3k-struni/runtests.sh Fri Jun 8 02:07:57 2007
@@ -27,7 +27,7 @@
# Compute the list of tests to run.
case $# in
0)
- TESTS=`(cd Lib/test; ls test_*.py | sed 's/\.py//' | grep -v test_socket)`
+ TESTS=`(cd Lib/test; ls test_*.py | sed 's/\.py//')`
;;
*)
TESTS="$@"
More information about the Python-3000-checkins
mailing list