]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Merged revisions 87341 via svnmerge from
authorAntoine Pitrou <solipsis@pitrou.net>
Fri, 17 Dec 2010 17:45:12 +0000 (17:45 +0000)
committerAntoine Pitrou <solipsis@pitrou.net>
Fri, 17 Dec 2010 17:45:12 +0000 (17:45 +0000)
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).
........

Lib/threading.py
Misc/NEWS

index 06fdfc14c226b8a587159fc2aaa32d656c9b6de3..5ac45e1abfc5f8a8db477c86da42100b35a96de8 100644 (file)
@@ -63,8 +63,14 @@ if __debug__:
         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:
index aca1fbb99e7ab38dbb8383e1dae23f73c9aa8b8f..150dee8b4e2f5fdb813b95d9cfd45e9d5b5a96c9 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -21,6 +21,10 @@ Core and Builtins
 
 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.