mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	Issue #4188: Avoid creating dummy thread objects when logging operations
from the threading module (with the internal verbose flag activated).
This commit is contained in:
		
							parent
							
								
									988dbd7bc2
								
							
						
					
					
						commit
						401edd69cf
					
				
					 2 changed files with 11 additions and 2 deletions
				
			
		| 
						 | 
					@ -55,8 +55,14 @@ def __init__(self, verbose=None):
 | 
				
			||||||
        def _note(self, format, *args):
 | 
					        def _note(self, format, *args):
 | 
				
			||||||
            if self._verbose:
 | 
					            if self._verbose:
 | 
				
			||||||
                format = format % args
 | 
					                format = format % args
 | 
				
			||||||
                format = "%s: %s\n" % (
 | 
					                # Issue #4188: calling current_thread() can incur an infinite
 | 
				
			||||||
                    current_thread().name, format)
 | 
					                # 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)
 | 
					                _sys.stderr.write(format)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
else:
 | 
					else:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,6 +20,9 @@ Core and Builtins
 | 
				
			||||||
Library
 | 
					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``
 | 
					- Issue #10711: Remove HTTP 0.9 support from http.client.  The ``strict``
 | 
				
			||||||
  parameter to HTTPConnection and friends is deprecated.
 | 
					  parameter to HTTPConnection and friends is deprecated.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue