From: Gregory P. Smith Date: Sun, 7 Sep 2008 01:03:35 +0000 (+0000) Subject: Backport of r66275/r66274 from trunk/py3k. This is the last bit of X-Git-Tag: v2.5.3c1~47 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=34c688129f6d01ccf1196e84601350542b4220a1;p=python Backport of r66275/r66274 from trunk/py3k. This is the last bit of the fix for issue 874900 to fix the use of the threading module in a post-fork python process. A NEWS entry for this already exists with the previous Lib/threading commit for this bug. --- diff --git a/Lib/threading.py b/Lib/threading.py index 1ecc06eb33..f2c6b3d56a 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -781,9 +781,12 @@ def _after_fork(): current = currentThread() _active_limbo_lock.acquire() try: - for ident, thread in _active.iteritems(): + for thread in _active.itervalues(): if thread is current: - # There is only one active thread. + # There is only one active thread. We reset the ident to + # its new value since it can have changed. + ident = _get_ident() + thread._Thread__ident = ident new_active[ident] = thread else: # All the others are already stopped.