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: 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 To: Python List 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 --nextPart1501399.sFLFpKgjeg Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" 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 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 --nextPart1501399.sFLFpKgjeg Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJTJy5JAAoJEHhsY/Mw18uSzlwQAIxd+26D09Eez201Gm6sCf4e 47ToX++/FrvCqmGF/x8VTeglVm8pJLw89uGDsx9EB6jGkQgXoefGEYZhgCxlP3vH 3W7EL3yBjLjlYidMf99jjN+5k5nx/ypmyOfOnCUMPdbr7to/Za9z+NwPvhdimBcO c5bqxx/j175/0rAnlPqHmelzZgtlC2nsvk5MT4ssm5LGfA1NsEJ5RCdm7+buKRRK b9Ck3xKgElbYKRTa2nam2g57XESYG7DMW2E2VR168w/rIsRoQqbrzHWjj5USjQo0 +fmN4YjTRA+HbhF+UkpAiRNAuo1/3AKpCMMgJq/jlBDFjBO6Q3wpT9uMFcStK8J0 4XtpgF2kygHqbv+bwUV8itz+WBmzwZyPYeRaOelCh+j5V1FLaY/xChS9RfkYjcwv NK7ghLzK6cO6w3Ahi+V0Hwy87/Y8+TlKPpry5gWwdWRCa4U96SWaDmawyAztxh3N 3mezW19nb+/Yk2ppu1nTTuEJuPjJ4EMhjy7FkdiuhPbZ3bxhg4QYwWQOOfrF9clI OQDq78n6vtwQEdRhaQ0SzP1mvhKS/QZ2oN8RSGcVQkFyqRU38roVq6Q5VESCNihE 1R1QaDXI3N35wO7HJ10bnvYPsWXi1N8u8AHjo2vysGNW/HRBVY4kIC9AbQnKovJq vaw29g4qO/MVMCEyIKvY =BhNs -----END PGP SIGNATURE----- --nextPart1501399.sFLFpKgjeg--