mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	Add a source parameter to warnings.warn()
Issue #26604: * Add a new optional source parameter to _warnings.warn() and warnings.warn() * Modify asyncore, asyncio and _pyio modules to set the source parameter when logging a ResourceWarning warning
This commit is contained in:
		
							parent
							
								
									060f9bb602
								
							
						
					
					
						commit
						e19558af1b
					
				
					 13 changed files with 34 additions and 19 deletions
				
			
		|  | @ -378,7 +378,8 @@ def close(self): | |||
|     if compat.PY34: | ||||
|         def __del__(self): | ||||
|             if self._pipe is not None: | ||||
|                 warnings.warn("unclosed transport %r" % self, ResourceWarning) | ||||
|                 warnings.warn("unclosed transport %r" % self, ResourceWarning, | ||||
|                               source=self) | ||||
|                 self._pipe.close() | ||||
| 
 | ||||
|     def _fatal_error(self, exc, message='Fatal error on pipe transport'): | ||||
|  | @ -567,7 +568,8 @@ def close(self): | |||
|     if compat.PY34: | ||||
|         def __del__(self): | ||||
|             if self._pipe is not None: | ||||
|                 warnings.warn("unclosed transport %r" % self, ResourceWarning) | ||||
|                 warnings.warn("unclosed transport %r" % self, ResourceWarning, | ||||
|                               source=self) | ||||
|                 self._pipe.close() | ||||
| 
 | ||||
|     def abort(self): | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Victor Stinner
						Victor Stinner