summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-12-17 17:45:12 +0000
committerAntoine Pitrou <solipsis@pitrou.net>2010-12-17 17:45:12 +0000
commit47900cfa73ee35313f019d1efdfd1b8e8e0b76f8 (patch)
tree8865ec2b582decb5fc5e8f867fa6195981d1c9c0
parent5c7fd6eefa457457f6f19e4397a79de5627af32e (diff)
downloadcpython-git-47900cfa73ee35313f019d1efdfd1b8e8e0b76f8.tar.gz
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). ........
-rw-r--r--Lib/threading.py10
-rw-r--r--Misc/NEWS4
2 files changed, 12 insertions, 2 deletions
diff --git a/Lib/threading.py b/Lib/threading.py
index 06fdfc14c2..5ac45e1abf 100644
--- a/Lib/threading.py
+++ b/Lib/threading.py
@@ -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:
diff --git a/Misc/NEWS b/Misc/NEWS
index aca1fbb99e..150dee8b4e 100644
--- 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.