Skip to content

class Thread has an isAlive on Python 3. #2552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
timabbott opened this issue Oct 24, 2018 · 1 comment · Fixed by #2565
Closed

class Thread has an isAlive on Python 3. #2552

timabbott opened this issue Oct 24, 2018 · 1 comment · Fixed by #2565
Labels
stubs: incomplete Annotations or sub-modules missing from an existing package or module

Comments

@timabbott
Copy link
Contributor

stdlib/2and3/threading.pyi defines class Thread like this:


```class Thread:                                                                                                             
   ...
    def is_alive(self) -> bool: ...                                                                                       
    if sys.version_info < (3,):                                                                                           
        def isAlive(self) -> bool: ...                                                                                    

It appears that isAlive still exists at least in Python 3.5, though it isn't documented:

tabbott@zaset:~/zulip$ ipython3
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
Type "copyright", "credits" or "license" for more information.

IPython 2.4.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from threading import *

In [2]: x = Thread()

In [3]: x.isAlive()
Out[3]: False

Not submitting a PR since I haven't had a chance to investigate whether other Python 3.x versions are different.

@srittau
Copy link
Collaborator

srittau commented Oct 24, 2018

It still exists:
https://github.com/python/cpython/blob/057f4078b044325dae4af55c4c64b684edaca315/Lib/threading.py#L1094

I assume the intent was to soft-deprecate isAlive() in favor of the PEP8-compatible is_alive(). That said, a PR to change this is welcome.

@srittau srittau added size-small stubs: incomplete Annotations or sub-modules missing from an existing package or module labels Oct 26, 2018
srittau pushed a commit that referenced this issue Oct 27, 2018
isAlive() is still present in threading.py in python 2.7, 3.4, 3.5, 3.6, 3.7.

Closes #2552
yedpodtrzitko pushed a commit to yedpodtrzitko/typeshed that referenced this issue Jan 23, 2019
isAlive() is still present in threading.py in python 2.7, 3.4, 3.5, 3.6, 3.7.

Closes python#2552
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stubs: incomplete Annotations or sub-modules missing from an existing package or module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants