bpo-37804: Remove the deprecated method threading.Thread.isAlive() (G… · python/cpython@44046fe

4 files changed

lines changed

Original file line numberDiff line numberDiff line change

@@ -186,6 +186,10 @@ Removed

186186

removed. They were deprecated since Python 3.7.

187187

(Contributed by Victor Stinner in :issue:`37320`.)

188188
189+

* The :meth:`~threading.Thread.isAlive()` method of :class:`threading.Thread`

190+

has been removed. It was deprecated since Python 3.8.

191+

Use :meth:`~threading.Thread.is_alive()` instead.

192+

(Contributed by Dong-hee Na in :issue:`37804`.)

189193
190194

Porting to Python 3.9

191195

=====================

Original file line numberDiff line numberDiff line change

@@ -422,8 +422,6 @@ def test_old_threading_api(self):

422422

t.setDaemon(True)

423423

t.getName()

424424

t.setName("name")

425-

with self.assertWarnsRegex(DeprecationWarning, 'use is_alive()'):

426-

t.isAlive()

427425

e = threading.Event()

428426

e.isSet()

429427

threading.activeCount()

Original file line numberDiff line numberDiff line change

@@ -1088,16 +1088,6 @@ def is_alive(self):

10881088

self._wait_for_tstate_lock(False)

10891089

return not self._is_stopped

10901090
1091-

def isAlive(self):

1092-

"""Return whether the thread is alive.

1093-
1094-

This method is deprecated, use is_alive() instead.

1095-

"""

1096-

import warnings

1097-

warnings.warn('isAlive() is deprecated, use is_alive() instead',

1098-

DeprecationWarning, stacklevel=2)

1099-

return self.is_alive()

1100-
11011091

@property

11021092

def daemon(self):

11031093

"""A boolean value indicating whether this thread is a daemon thread.

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,2 @@

1+

Remove the deprecated method `threading.Thread.isAlive()`. Patch by Dong-hee

2+

Na.