[Python-checkins] test_asyncore: Optimize capture_server() (#93867)

vstinner webhook-mailer at python.org
Wed Jun 15 12:28:36 EDT 2022


https://github.com/python/cpython/commit/46e455f21c23b03fd68055fbd97e9d0c449f00a5
commit: 46e455f21c23b03fd68055fbd97e9d0c449f00a5
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2022-06-15T18:28:31+02:00
summary:

test_asyncore: Optimize capture_server() (#93867)

Remove time.sleep(0.01) in test_asyncore capture_server(). The sleep
was redundant and inefficient, since the loop starts with
select.select() which also implements a sleep (poll for socket data
with a timeout).

files:
M Lib/test/test_asyncore.py

diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py
index 1564221f85715..dd6b3a3648e6b 100644
--- a/Lib/test/test_asyncore.py
+++ b/Lib/test/test_asyncore.py
@@ -87,7 +87,6 @@ def capture_server(evt, buf, serv):
                     break
             if n <= 0:
                 break
-            time.sleep(0.01)
 
         conn.close()
     finally:



More information about the Python-checkins mailing list