bpo-35283: Add deprecation warning for Thread.isAlive (GH-11454)

Add a deprecated warning for the threading.Thread.isAlive() method.
This commit is contained in:
Dong-hee Na 2019-01-17 21:14:45 +09:00 committed by Victor Stinner
parent 97e12996f3
commit 89669ffe10
5 changed files with 17 additions and 4 deletions

View file

@ -1091,7 +1091,15 @@ class Thread:
self._wait_for_tstate_lock(False)
return not self._is_stopped
isAlive = is_alive
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):