Repository navigation
Closed
Labels
3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = <Date 2019-01-18.14:17:47.552>
created_at = <Date 2018-11-20.22:16:29.238>
labels = ['3.7', '3.8', 'type-bug', 'library']
title = '"threading._DummyThread" redefines "is_alive" but forgets "isAlive"'
updated_at = <Date 2019-01-18.14:17:47.547>
user = 'https://github.com/d-maurer'bugs.python.org fields:
activity = <Date 2019-01-18.14:17:47.547>
actor = 'asvetlov'
assignee = 'none'
closed = True
closed_date = <Date 2019-01-18.14:17:47.552>
closer = 'asvetlov'
components = ['Library (Lib)']
creation = <Date 2018-11-20.22:16:29.238>
creator = 'dmaurer'
dependencies = []
files = []
hgrepos = []
issue_num = 35283
keywords = ['patch']
message_count = 27.0
messages = ['330158', '330216', '330219', '330237', '330242', '330244', '330245', '330247', '330248', '330277', '330278', '330279', '330280', '330293', '330472', '330917', '330922', '333156', '333170', '333854', '333856', '333911', '333930', '333951', '333954', '333955', '333966']
nosy_count = 7.0
nosy_names = ['brett.cannon', 'dmaurer', 'vstinner', 'asvetlov', 'pmpp', 'serhiy.storchaka', 'corona10']
pr_nums = ['11454', '11454', '11454', '11459', '11459', '11459', '11596', '11596', '11596', '11604', '11604', '11604']
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue35283'
versions = ['Python 3.7', 'Python 3.8']Metadata
Metadata
Assignees
Labels
3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of lifestdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
d-maurer commentedon Nov 20, 2018
In module "threading", class "Thread" defines "is_alive" and defines "isAlive = is_alive". The derived class "_DummyThread" redefines "is_alive" but forgets to update the "isAlive" alias. As a consequence, calling "_DummyThread.isAlive" leads to an "AssertionErrror".
The "isAlive" method is mentioned in the docstring of "Thread.join".
brettcannon commentedon Nov 21, 2018
Care to open a PR to fix this?
d-maurer commentedon Nov 21, 2018
I am not familiar with the "github" workflow. The fix is so trivial (add the "isAlive = is_alive" alias to "threading._DummyThread" and replace "isAlive" by "is_alive" in the docstring of "threading.Thread.join" that it does not seem worth to learn the "github" workflow just for this fix.
corona10 commentedon Nov 22, 2018
Hi, Can I work with this issue if no one works on it?
serhiy-storchaka commentedon Nov 22, 2018
isAlive() is the part of the old API. It is not even documented in Python 3, and can be removed in future. It is better to remove it from docstrings.
serhiy-storchaka commentedon Nov 22, 2018
And since threads support no longer optional, are there reasons to keep _DummyThread?
pitrou commentedon Nov 22, 2018
If it's not already deprecated, I'd say deprecate it first.
corona10 commentedon Nov 22, 2018
@serhiy.storchaka @pitrou
Then should we add the deprecated message
for isAlive of class "Thread" first?
asvetlov commentedon Nov 22, 2018
The only _DummyThread usage is
threading.current_thread():brettcannon commentedon Nov 22, 2018
I guess the question is whether any other Python implementation is threadless? E.g. is MicroPython? If it even has threads then I agree about deprecating the module.
But if MicroPython does support threads we should keep the module. That would mean updating all references of isAlive() to is_alive() and adding the name alias since that name aliasing still exists in 'master' right now (probably for Python 2 porting support):
cpython/Lib/threading.py
Line 1094 in 3bb183d
@dmaurer totally understand about time restraints, but do realize even "trivial" fixes like this would still take at least an hour to do a proper job so there's no guarantee someone will get around to fixing this. But if you do change your mind and want to give it a try, then https://devguide.python.org/ is there to help.
pmp-p commentedon Nov 22, 2018
emscripten python ( cpython on asm.js or webassembly ) is threadless
5 remaining items
d-maurer commentedon Dec 3, 2018
For me, this would be perfect.
vstinner commentedon Jan 7, 2019
I suggest to start with:
We may apply such changes to Python 3.7, maybe also emit a PendingDeprecationWarning.
corona10 commentedon Jan 7, 2019
@vstinner
Thanks, I've submitted PR 11459 for 3.7 which emit PendingDeprecationWarning.
vstinner commentedon Jan 17, 2019
New changeset 89669ff by Victor Stinner (Dong-hee Na) in branch 'master':
bpo-35283: Add deprecation warning for Thread.isAlive (GH-11454)
89669ff
vstinner commentedon Jan 17, 2019
Ok, master now emits a deprecation warning. Is it worth it to emit a pending deprecation warning in Python 3.7?
asvetlov commentedon Jan 17, 2019
I think yes.
People will be notified about depreciation earlier, even after 3.8 release not everybody switches to a new version fast.
For example, I still use 3.6 for my job now (but we are planning to switch to 3.7 in a month or two).
Adding PendingDeprecationWarning to 3.7 is safe, I expect a very few code uses
.isAlive()on Python 3.corona10 commentedon Jan 18, 2019
Great!
Should we notify this deprecation also on Doc/whatsnew/3.7.rst?
asvetlov commentedon Jan 18, 2019
Not sure. IMHO it is not a *notable* change worth to be mentioned in https://docs.python.org/3/whatsnew/3.7.html#notable-changes-in-python-3-7-2
corona10 commentedon Jan 18, 2019
I've upload PR 11604
Thanks always
vstinner commentedon Jan 18, 2019
New changeset 36d9e9a by Victor Stinner (Dong-hee Na) in branch 'master':
bpo-35283: Update the docstring of threading.Thread.join method (GH-11596)
36d9e9a
vstinner commentedon Jan 18, 2019
New changeset c2647f2 by Victor Stinner (Dong-hee Na) in branch '3.7':
bpo-35283: Add pending deprecation warning for Thread.isAlive (GH-11604)
c2647f2