mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	bpo-39529: Deprecate creating new event loop in asyncio.get_event_loop() (GH-23554)
asyncio.get_event_loop() emits now a deprecation warning when it creates a new event loop. In future releases it will became an alias of asyncio.get_running_loop().
This commit is contained in:
		
							parent
							
								
									face87c94e
								
							
						
					
					
						commit
						172c0f2752
					
				
					 16 changed files with 570 additions and 185 deletions
				
			
		|  | @ -125,7 +125,7 @@ class FlowControlMixin(protocols.Protocol): | |||
| 
 | ||||
|     def __init__(self, loop=None): | ||||
|         if loop is None: | ||||
|             self._loop = events.get_event_loop() | ||||
|             self._loop = events._get_event_loop(stacklevel=4) | ||||
|         else: | ||||
|             self._loop = loop | ||||
|         self._paused = False | ||||
|  | @ -283,9 +283,13 @@ def _get_close_waiter(self, stream): | |||
|     def __del__(self): | ||||
|         # Prevent reports about unhandled exceptions. | ||||
|         # Better than self._closed._log_traceback = False hack | ||||
|         closed = self._closed | ||||
|         if closed.done() and not closed.cancelled(): | ||||
|             closed.exception() | ||||
|         try: | ||||
|             closed = self._closed | ||||
|         except AttributeError: | ||||
|             pass  # failed constructor | ||||
|         else: | ||||
|             if closed.done() and not closed.cancelled(): | ||||
|                 closed.exception() | ||||
| 
 | ||||
| 
 | ||||
| class StreamWriter: | ||||
|  | @ -381,7 +385,7 @@ def __init__(self, limit=_DEFAULT_LIMIT, loop=None): | |||
| 
 | ||||
|         self._limit = limit | ||||
|         if loop is None: | ||||
|             self._loop = events.get_event_loop() | ||||
|             self._loop = events._get_event_loop() | ||||
|         else: | ||||
|             self._loop = loop | ||||
|         self._buffer = bytearray() | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka