From 44046fe4fc7f00a6eb855b33e6a3f953cf5233a5 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Tue, 13 Aug 2019 02:41:08 +0900 Subject: bpo-37804: Remove the deprecated method threading.Thread.isAlive() (GH-15225) --- Doc/whatsnew/3.9.rst | 4 ++++ Lib/test/test_threading.py | 2 -- Lib/threading.py | 10 ---------- .../next/Library/2019-08-12-23-07-47.bpo-37804.Ene6L-.rst | 2 ++ 4 files changed, 6 insertions(+), 12 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2019-08-12-23-07-47.bpo-37804.Ene6L-.rst diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 61d9e74..f09e09c 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 1466d25..7c16974 100644 --- a/Lib/test/test_threading.py +++ b/Lib/test/test_threading.py @@ -422,8 +422,6 @@ class ThreadTests(BaseTestCase): 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 cec9cdb..32a3d7c 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -1088,16 +1088,6 @@ class Thread: 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 0000000..ebbcb5a --- /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. -- cgit v0.12