Kaydet (Commit) 2bf7138b authored tarafından Guido van Rossum's avatar Guido van Rossum

Make test_socket work.

Don't exclude test_socket from the tests to run.
üst 7cad4f3d
...@@ -300,17 +300,23 @@ class IOBase: ...@@ -300,17 +300,23 @@ class IOBase:
def readline(self, limit: int = -1) -> bytes: def readline(self, limit: int = -1) -> bytes:
"""For backwards compatibility, a (slowish) readline().""" """For backwards compatibility, a (slowish) readline()."""
if limit is None: if hasattr(self, "peek"):
limit = -1 def nreadahead():
res = bytes()
while limit < 0 or len(res) < limit:
readahead = self.peek(1, unsafe=True) readahead = self.peek(1, unsafe=True)
if not readahead: if not readahead:
break return 1
n = (readahead.find(b"\n") + 1) or len(readahead) n = (readahead.find(b"\n") + 1) or len(readahead)
if limit >= 0: if limit >= 0:
n = min(n, limit) n = min(n, limit)
b = self.read(n) return n
else:
def nreadahead():
return 1
if limit is None:
limit = -1
res = bytes()
while limit < 0 or len(res) < limit:
b = self.read(nreadahead())
if not b: if not b:
break break
res += b res += b
......
...@@ -27,7 +27,7 @@ mkdir -p OUT ...@@ -27,7 +27,7 @@ mkdir -p OUT
# Compute the list of tests to run. # Compute the list of tests to run.
case $# in case $# in
0) 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="$@" TESTS="$@"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment