Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #68437
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <felixonmars@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'broken': 0.04; 'subject:Python': 0.06; 'practice,': 0.07; 'exits': 0.09; 'received:localnet': 0.09; 'reference:': 0.09; 'snippet': 0.09; 'url:github': 0.09; 'python': 0.11; 'def': 0.12; 'bug': 0.12; 'thread': 0.14; '3.3,': 0.16; 'called,': 0.16; 'downstream': 0.16; 'filename:fname piece:signature': 0.16; 'itself,': 0.16; 'raised.': 0.16; 'to:name:python list': 0.16; 'undocumented': 0.16; 'url:issues': 0.16; 'exception': 0.16; 'trying': 0.19; 'reports,': 0.19; 'import': 0.22; 'header:User-Agent:1': 0.23; 'skip:" 30': 0.26; 'wonder': 0.29; 'assert': 0.31; 'file': 0.32; '(most': 0.33; 'skip:# 10': 0.33; 'noticed': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'method': 0.36; 'to:addr:python-list': 0.38; 'list,': 0.38; 'recent': 0.39; 'to:addr:python.org': 0.39; 'easy': 0.60; 'skip:t 30': 0.61; 'behavior': 0.77; 'fail.': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:user-agent:mime-version :content-type; bh=cUfPiR5wfOpI1OGKTn1++5ICM6YPy4N5cXgLfqzxKWY=; b=L/ZJ5rX7vZH0QBBLA3EO4scwhUPwBjhBT7T0/0l6FapszvNQEKhWnZdJh78Nopg4hz Lxil53CE5fDuArcNI0dexX5QI9bX4ln3lL+DQITX9lPS+fiiDUCx6vYJJXFrlp6ODyc9 iBDXYCtutsDtb2aiSMUrd99n+DRdzpyj6j9oPC9XGXMDeDfN2Lh8YNef1Mk5ZAekJ1mz Pn15bezy4SHPPJ8W+OVVZSYAgEGW+ZDwFVnj76U1SxXDSmoroSBVM1JpbrzJ2a1wc9li ouuF1kFj//zBoGOTAWCHHQXR9taYvVcgaD2F1zOT6QI9k7px2TiCr2blRXXbuEZkUfnq c5hQ== |
| X-Received | by 10.181.13.112 with SMTP id ex16mr10672138wid.23.1395076685502; Mon, 17 Mar 2014 10:18:05 -0700 (PDT) |
| From | Felix Yan <felixonmars@gmail.com> |
| To | Python List <python-list@python.org> |
| Subject | Thread._stop() behavior changed in Python 3.4 |
| Date | Tue, 18 Mar 2014 01:18:01 +0800 |
| User-Agent | KMail/4.12.3 (Linux/3.13.6-1-uksm; KDE/4.12.3; x86_64; ; ) |
| MIME-Version | 1.0 |
| Content-Type | multipart/signed; boundary="nextPart1501399.sFLFpKgjeg"; micalg="pgp-sha1"; protocol="application/pgp-signature" |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.8204.1395076687.18130.python-list@python.org> (permalink) |
| Lines | 73 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1395076687 news.xs4all.nl 2965 [2001:888:2000:d::a6]:39047 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:68437 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
Hi list,
I noticed a behavior change on Thread._stop() with Python 3.4.
I know the method is an undocumented "feature" itself, but some projects are
using it, and now they fail.
A minimized snippet to reproduce:
#!/usr/bin/python
import threading
def stale():
import time
time.sleep(1000)
t = threading.Thread(target=stale)
t.start()
t._stop()
This works correctly with Python 3.3, the program exits immediately after
t._stop() called, and no exception was raised.
But with Python 3.4, an AssertionError was raised:
Traceback (most recent call last):
File "test.py", line 8, in <module>
t._stop()
File "/usr/lib/python3.4/threading.py", line 990, in _stop
assert not lock.locked()
AssertionError
And the program still waits on the sleep().
I know trying to forcefully stop a thread is not really a good practice, but I
still wonder if there's an easy way to get broken programs to work again, just
in the way they currently are?
Downstream bug reports, for reference:
http://youtrack.jetbrains.com/issue/PY-12317
https://github.com/paramiko/paramiko/issues/286
Regards,
Felix Yan
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Thread._stop() behavior changed in Python 3.4 Felix Yan <felixonmars@gmail.com> - 2014-03-18 01:18 +0800
csiph-web