On Tue, Mar 18, 2014 at 4:18 AM, Felix Yan <felixonm...@gmail.com> wrote: > 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. > > 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?
You're using something that has a leading underscore on the name. Frankly, you shouldn't be doing that. Your code was already broken, before 3.4 came along, and it's just that 3.4 highlighted that brokenness. The PyCharm report that this is a Python 3.4 bug is simply incorrect. This code should be a strong indication that something's reaching into places it shouldn't be: https://github.com/JetBrains/intellij-community/blob/master/python/helpers/pydev/pydevd_comm.py#L109 The solution is to have the thread acknowledge, in some way, that it needs to shut down. Forcefully stopping a thread is actually a really bad practice, at least in Python (with OS/2 and VX-REXX, it's a different matter). Antoine says that this doesn't even stop the thread (I can't say; I've never used _stop(), for obvious reasons), so this code was doubly broken. The change in 3.4 should be an excuse to fix the code so it actually works, and works according to the spec, which will mean it works on all versions. ChrisA -- https://mail.python.org/mailman/listinfo/python-list