[Python-checkins] bpo-37804: Remove the deprecated method threading.Thread.isAlive() (GH-15225)

Victor Stinner webhook-mailer at python.org
Mon Aug 12 13:41:32 EDT 2019


https://github.com/python/cpython/commit/44046fe4fc7f00a6eb855b33e6a3f953cf5233a5
commit: 44046fe4fc7f00a6eb855b33e6a3f953cf5233a5
branch: master
author: Dong-hee Na <donghee.na92 at gmail.com>
committer: Victor Stinner <vstinner at redhat.com>
date: 2019-08-12T19:41:08+02:00
summary:

bpo-37804: Remove the deprecated method threading.Thread.isAlive() (GH-15225)

files:
A Misc/NEWS.d/next/Library/2019-08-12-23-07-47.bpo-37804.Ene6L-.rst
M Doc/whatsnew/3.9.rst
M Lib/test/test_threading.py
M Lib/threading.py

diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst
index 61d9e745e87c..f09e09c2b905 100644
--- a/Doc/whatsnew/3.9.rst
+++ b/Doc/whatsnew/3.9.rst
@@ -186,6 +186,10 @@ Removed
   removed. They were deprecated since Python 3.7.
   (Contributed by Victor Stinner in :issue:`37320`.)
 
+* The :meth:`~threading.Thread.isAlive()` method of :class:`threading.Thread`
+  has been removed. It was deprecated since Python 3.8.
+  Use :meth:`~threading.Thread.is_alive()` instead.
+  (Contributed by Dong-hee Na in :issue:`37804`.)
 
 Porting to Python 3.9
 =====================
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 1466d25e9482..7c16974c1630 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -422,8 +422,6 @@ def test_old_threading_api(self):
         t.setDaemon(True)
         t.getName()
         t.setName("name")
-        with self.assertWarnsRegex(DeprecationWarning, 'use is_alive()'):
-            t.isAlive()
         e = threading.Event()
         e.isSet()
         threading.activeCount()
diff --git a/Lib/threading.py b/Lib/threading.py
index cec9cdb8e698..32a3d7c30336 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -1088,16 +1088,6 @@ def is_alive(self):
         self._wait_for_tstate_lock(False)
         return not self._is_stopped
 
-    def isAlive(self):
-        """Return whether the thread is alive.
-
-        This method is deprecated, use is_alive() instead.
-        """
-        import warnings
-        warnings.warn('isAlive() is deprecated, use is_alive() instead',
-                      DeprecationWarning, stacklevel=2)
-        return self.is_alive()
-
     @property
     def daemon(self):
         """A boolean value indicating whether this thread is a daemon thread.
diff --git a/Misc/NEWS.d/next/Library/2019-08-12-23-07-47.bpo-37804.Ene6L-.rst b/Misc/NEWS.d/next/Library/2019-08-12-23-07-47.bpo-37804.Ene6L-.rst
new file mode 100644
index 000000000000..ebbcb5aa7788
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2019-08-12-23-07-47.bpo-37804.Ene6L-.rst
@@ -0,0 +1,2 @@
+Remove the deprecated method `threading.Thread.isAlive()`. Patch by Dong-hee
+Na.



More information about the Python-checkins mailing list