[Python-checkins] bpo-43723: Fix deprecation error caused by thread.setDaemon() (GH-25361)

tiran webhook-mailer at python.org
Mon Apr 12 07:13:04 EDT 2021


https://github.com/python/cpython/commit/95bbb331ecb3ef5d05859d90b287cc3d27613c86
commit: 95bbb331ecb3ef5d05859d90b287cc3d27613c86
branch: master
author: Christian Heimes <christian at python.org>
committer: tiran <christian at python.org>
date: 2021-04-12T13:12:36+02:00
summary:

bpo-43723: Fix deprecation error caused by thread.setDaemon() (GH-25361)

files:
M Lib/test/test_asyncio/test_streams.py
M Lib/test/test_logging.py
M Lib/test/test_telnetlib.py
M Tools/ccbench/ccbench.py

diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py
index aa3977977588e..a075358903920 100644
--- a/Lib/test/test_asyncio/test_streams.py
+++ b/Lib/test/test_asyncio/test_streams.py
@@ -799,7 +799,7 @@ async def client(host, port):
 
         # Start the server thread and wait for it to be listening.
         thread = threading.Thread(target=server)
-        thread.setDaemon(True)
+        thread.daemon = True
         thread.start()
         addr = q.get()
 
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
index 452ba78523443..6179e28759cce 100644
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -849,7 +849,7 @@ def start(self):
         """
         self._thread = t = threading.Thread(target=self.serve_forever,
                                             args=(self.poll_interval,))
-        t.setDaemon(True)
+        t.daemon = True
         t.start()
 
     def serve_forever(self, poll_interval):
@@ -901,7 +901,7 @@ def start(self):
         """
         self._thread = t = threading.Thread(target=self.serve_forever,
                                             args=(self.poll_interval,))
-        t.setDaemon(True)
+        t.daemon = True
         t.start()
 
     def serve_forever(self, poll_interval):
diff --git a/Lib/test/test_telnetlib.py b/Lib/test/test_telnetlib.py
index 8e36051cd095b..41c4fcd4195e3 100644
--- a/Lib/test/test_telnetlib.py
+++ b/Lib/test/test_telnetlib.py
@@ -29,7 +29,7 @@ def setUp(self):
         self.sock.settimeout(60)  # Safety net. Look issue 11812
         self.port = socket_helper.bind_port(self.sock)
         self.thread = threading.Thread(target=server, args=(self.evt,self.sock))
-        self.thread.setDaemon(True)
+        self.thread.daemon = True
         self.thread.start()
         self.evt.wait()
 
diff --git a/Tools/ccbench/ccbench.py b/Tools/ccbench/ccbench.py
index ab1465a276092..d52701a82948d 100644
--- a/Tools/ccbench/ccbench.py
+++ b/Tools/ccbench/ccbench.py
@@ -221,7 +221,7 @@ def run():
     for i in range(nthreads):
         threads.append(threading.Thread(target=run))
     for t in threads:
-        t.setDaemon(True)
+        t.daemon = True
         t.start()
     # We don't want measurements to include thread startup overhead,
     # so we arrange for timing to start after all threads are ready.
@@ -328,7 +328,7 @@ def run():
         for i in range(nthreads):
             threads.append(threading.Thread(target=run))
         for t in threads:
-            t.setDaemon(True)
+            t.daemon = True
             t.start()
         # Wait for threads to be ready
         with ready_cond:
@@ -460,7 +460,7 @@ def run():
             for i in range(nthreads):
                 threads.append(threading.Thread(target=run))
             for t in threads:
-                t.setDaemon(True)
+                t.daemon = True
                 t.start()
             # Wait for threads to be ready
             with ready_cond:



More information about the Python-checkins mailing list