]> granicus.if.org Git - python/commitdiff
Backport relevant part of r66274 (in issue #874900).
authorAntoine Pitrou <solipsis@pitrou.net>
Sat, 6 Sep 2008 23:04:32 +0000 (23:04 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Sat, 6 Sep 2008 23:04:32 +0000 (23:04 +0000)
Lib/threading.py

index 25eb9b61c7e4a3c039451df8d3f2413d22c09577..a776c66752b0dfe74cd06a5611e0d1bd83ceafc7 100644 (file)
@@ -847,9 +847,12 @@ def _after_fork():
     new_active = {}
     current = current_thread()
     with _active_limbo_lock:
-        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.