Thread._stop() behavior changed in Python 3.4

Felix Yan felixonmars at
Mon Mar 17 18:18:01 CET 2014

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:

import threading
def stale():
    import time
t = threading.Thread(target=stale)

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 "", line 8, in <module>
  File "/usr/lib/python3.4/", line 990, in _stop
    assert not lock.locked()

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:

Felix Yan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the Python-list mailing list