Crash in thread on program termination

Eric Ries eric.ries at aya.yale.edu
Mon Mar 28 21:19:29 EST 2005


I just recently came across this post from the mailing list:

http://mail.python.org/pipermail/python-list/2005-February/265569.html

in which the error with daemon threads at interpreter shutdown is discussed.
I have experienced this problem in numerous programs that I've written and
wanted to write in with a solution. I don't know if this has already been
discussed elsewhere, but I could not find it. Bug #75444 is marked fixed,
but the discussion attached to the bug leaves me unclear as to whether the
bug has been fixed or if simply there are fewer places where it can happen
now. So I'm offering the fix that has worked for me (in python 2.3) on the
off-chance that it is useful. If not, please feel free to disregard.

Attached you'll find my modified copy of python 2.3's threading.py - it is
mostly unmodified except for a few blocks which have been moved around.
Where possible, I have attempted to have functions bind currentThread and
other module globals into their own local namespace. I probably didn't catch
every case where this happens, but it works well enough for me.

Thanks,

Eric
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: threading.py
URL: <http://mail.python.org/pipermail/python-list/attachments/20050328/ddde5df8/attachment.ksh>


More information about the Python-list mailing list