diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-12-17 17:44:45 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-12-17 17:44:45 (GMT) |
commit | bc7f20cea4dba44214edf5222afb18c4452f747d (patch) | |
tree | 3c1c7844dd62d9cb9a086a1e854d688a09ef88bc /Lib/threading.py | |
parent | 3396e8671d15ff90f0197a4215bb14e48a593837 (diff) | |
download | cpython-bc7f20cea4dba44214edf5222afb18c4452f747d.zip cpython-bc7f20cea4dba44214edf5222afb18c4452f747d.tar.gz cpython-bc7f20cea4dba44214edf5222afb18c4452f747d.tar.bz2 |
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).
........
Diffstat (limited to 'Lib/threading.py')
-rw-r--r-- | Lib/threading.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/threading.py b/Lib/threading.py index 178c8fd..24808d4 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -50,8 +50,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: |