[Python-checkins] r87341 - in python/branches/py3k: Lib/threading.py Misc/NEWS
antoine.pitrou
python-checkins at python.org
Fri Dec 17 18:42:16 CET 2010
Author: antoine.pitrou
Date: Fri Dec 17 18:42:16 2010
New Revision: 87341
Log:
Issue #4188: Avoid creating dummy thread objects when logging operations
from the threading module (with the internal verbose flag activated).
Modified:
python/branches/py3k/Lib/threading.py
python/branches/py3k/Misc/NEWS
Modified: python/branches/py3k/Lib/threading.py
==============================================================================
--- python/branches/py3k/Lib/threading.py (original)
+++ python/branches/py3k/Lib/threading.py Fri Dec 17 18:42:16 2010
@@ -55,8 +55,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/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Fri Dec 17 18:42:16 2010
@@ -20,6 +20,9 @@
Library
-------
+- Issue #4188: Avoid creating dummy thread objects when logging operations
+ from the threading module (with the internal verbose flag activated).
+
- Issue #10711: Remove HTTP 0.9 support from http.client. The ``strict``
parameter to HTTPConnection and friends is deprecated.
More information about the Python-checkins
mailing list