File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -300,17 +300,23 @@ def isatty(self) -> bool:
300300
301301 def readline (self , limit : int = - 1 ) -> bytes :
302302 """For backwards compatibility, a (slowish) readline()."""
303+ if hasattr (self , "peek" ):
304+ def nreadahead ():
305+ readahead = self .peek (1 , unsafe = True )
306+ if not readahead :
307+ return 1
308+ n = (readahead .find (b"\n " ) + 1 ) or len (readahead )
309+ if limit >= 0 :
310+ n = min (n , limit )
311+ return n
312+ else :
313+ def nreadahead ():
314+ return 1
303315 if limit is None :
304316 limit = - 1
305317 res = bytes ()
306318 while limit < 0 or len (res ) < limit :
307- readahead = self .peek (1 , unsafe = True )
308- if not readahead :
309- break
310- n = (readahead .find (b"\n " ) + 1 ) or len (readahead )
311- if limit >= 0 :
312- n = min (n , limit )
313- b = self .read (n )
319+ b = self .read (nreadahead ())
314320 if not b :
315321 break
316322 res += b
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ mkdir -p OUT
2727# Compute the list of tests to run.
2828case $# in
29290)
30- TESTS=` (cd Lib/test; ls test_* .py | sed ' s/\.py//' | grep -v test_socket )`
30+ TESTS=` (cd Lib/test; ls test_* .py | sed ' s/\.py//' )`
3131 ;;
3232* )
3333 TESTS=" $@ "
You can’t perform that action at this time.
0 commit comments