]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Make test_socket work.
authorGuido van Rossum <guido@python.org>
Fri, 8 Jun 2007 00:07:57 +0000 (00:07 +0000)
committerGuido van Rossum <guido@python.org>
Fri, 8 Jun 2007 00:07:57 +0000 (00:07 +0000)
Don't exclude test_socket from the tests to run.

Lib/io.py
runtests.sh

index 4d46b477a55b34c8d22fde0f0dda6b7aa4ac2f0d..4c9ddbb87ccb70dff21ff704120c56c989204a80 100644 (file)
--- a/Lib/io.py
+++ b/Lib/io.py
@@ -300,17 +300,23 @@ class IOBase:
 
     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
index 5a03b0a34233ee1fb57137b2b0bf4de89dbe8899..c90460e2fa560d14d51c863744fc6151c9fe2d3c 100755 (executable)
@@ -27,7 +27,7 @@ mkdir -p OUT
 # 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="$@"