[Python-checkins] r87343 - in python/branches/release27-maint: Lib/threading.py Misc/NEWS

antoine.pitrou python-checkins at python.org
Fri Dec 17 18:45:13 CET 2010


Author: antoine.pitrou
Date: Fri Dec 17 18:45:12 2010
New Revision: 87343

Log:
Merged revisions 87341 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r87341 | antoine.pitrou | 2010-12-17 18:42:16 +0100 (ven., 17 déc. 2010) | 4 lines
  
  Issue #4188: Avoid creating dummy thread objects when logging operations
  from the threading module (with the internal verbose flag activated).
........


Modified:
   python/branches/release27-maint/   (props changed)
   python/branches/release27-maint/Lib/threading.py
   python/branches/release27-maint/Misc/NEWS

Modified: python/branches/release27-maint/Lib/threading.py
==============================================================================
--- python/branches/release27-maint/Lib/threading.py	(original)
+++ python/branches/release27-maint/Lib/threading.py	Fri Dec 17 18:45:12 2010
@@ -63,8 +63,14 @@
         def _note(self, format, *args):
             if self.__verbose:
                 format = format % args
-                format = "%s: %s\n" % (
-                    current_thread().name, format)
+                # Issue #4188: calling current_thread() can incur an infinite
+                # recursion if it has to create a DummyThread on the fly.
+                ident = _get_ident()
+                try:
+                    name = _active[ident].name
+                except KeyError:
+                    name = "<OS thread %d>" % ident
+                format = "%s: %s\n" % (name, format)
                 _sys.stderr.write(format)
 
 else:

Modified: python/branches/release27-maint/Misc/NEWS
==============================================================================
--- python/branches/release27-maint/Misc/NEWS	(original)
+++ python/branches/release27-maint/Misc/NEWS	Fri Dec 17 18:45:12 2010
@@ -21,6 +21,10 @@
 
 Library
 -------
+
+- Issue #4188: Avoid creating dummy thread objects when logging operations
+  from the threading module (with the internal verbose flag activated).
+
 - Issue #9721: Fix the behavior of urljoin when the relative url starts with a
   ';' character. Patch by Wes Chow.
 


More information about the Python-checkins mailing list