diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-12-17 17:42:16 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-12-17 17:42:16 (GMT) |
commit | 401edd69cf23f7f102aece55e05157daf1b87f9f (patch) | |
tree | 7baf64e3ca486395af74948c01124c8fb79cdf16 | |
parent | 988dbd7bc2bb8a41cf91a12c8bff9a916651769f (diff) | |
download | cpython-401edd69cf23f7f102aece55e05157daf1b87f9f.zip cpython-401edd69cf23f7f102aece55e05157daf1b87f9f.tar.gz cpython-401edd69cf23f7f102aece55e05157daf1b87f9f.tar.bz2 |
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.py | 10 | ||||
-rw-r--r-- | Misc/NEWS | 3 |
2 files changed, 11 insertions, 2 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index b6c1e5d..01c27b8 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -55,8 +55,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: @@ -20,6 +20,9 @@ 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 #10711: Remove HTTP 0.9 support from http.client. The ``strict`` parameter to HTTPConnection and friends is deprecated. |