mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Another asyncio sync.
This commit is contained in:
		
							parent
							
								
									f6d991d885
								
							
						
					
					
						commit
						4357cf6202
					
				
					 2 changed files with 11 additions and 5 deletions
				
			
		|  | @ -13,7 +13,6 @@ | ||||||
| to modify the meaning of the API call itself. | to modify the meaning of the API call itself. | ||||||
| """ | """ | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| import collections | import collections | ||||||
| import concurrent.futures | import concurrent.futures | ||||||
| import heapq | import heapq | ||||||
|  | @ -1128,7 +1127,7 @@ def subprocess_shell(self, protocol_factory, cmd, *, stdin=subprocess.PIPE, | ||||||
|         transport = yield from self._make_subprocess_transport( |         transport = yield from self._make_subprocess_transport( | ||||||
|             protocol, cmd, True, stdin, stdout, stderr, bufsize, **kwargs) |             protocol, cmd, True, stdin, stdout, stderr, bufsize, **kwargs) | ||||||
|         if self._debug: |         if self._debug: | ||||||
|             logger.info('%s: %r' % (debug_log, transport)) |             logger.info('%s: %r', debug_log, transport) | ||||||
|         return transport, protocol |         return transport, protocol | ||||||
| 
 | 
 | ||||||
|     @coroutine |     @coroutine | ||||||
|  | @ -1158,7 +1157,7 @@ def subprocess_exec(self, protocol_factory, program, *args, | ||||||
|             protocol, popen_args, False, stdin, stdout, stderr, |             protocol, popen_args, False, stdin, stdout, stderr, | ||||||
|             bufsize, **kwargs) |             bufsize, **kwargs) | ||||||
|         if self._debug: |         if self._debug: | ||||||
|             logger.info('%s: %r' % (debug_log, transport)) |             logger.info('%s: %r', debug_log, transport) | ||||||
|         return transport, protocol |         return transport, protocol | ||||||
| 
 | 
 | ||||||
|     def get_exception_handler(self): |     def get_exception_handler(self): | ||||||
|  | @ -1238,7 +1237,9 @@ def call_exception_handler(self, context): | ||||||
|         - 'handle' (optional): Handle instance; |         - 'handle' (optional): Handle instance; | ||||||
|         - 'protocol' (optional): Protocol instance; |         - 'protocol' (optional): Protocol instance; | ||||||
|         - 'transport' (optional): Transport instance; |         - 'transport' (optional): Transport instance; | ||||||
|         - 'socket' (optional): Socket instance. |         - 'socket' (optional): Socket instance; | ||||||
|  |         - 'asyncgen' (optional): Asynchronous generator that caused | ||||||
|  |                                  the exception. | ||||||
| 
 | 
 | ||||||
|         New keys maybe introduced in the future. |         New keys maybe introduced in the future. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -519,7 +519,7 @@ def sleep(delay, result=None, *, loop=None): | ||||||
|         h.cancel() |         h.cancel() | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| def async(coro_or_future, *, loop=None): | def async_(coro_or_future, *, loop=None): | ||||||
|     """Wrap a coroutine in a future. |     """Wrap a coroutine in a future. | ||||||
| 
 | 
 | ||||||
|     If the argument is a Future, it is returned directly. |     If the argument is a Future, it is returned directly. | ||||||
|  | @ -532,6 +532,11 @@ def async(coro_or_future, *, loop=None): | ||||||
| 
 | 
 | ||||||
|     return ensure_future(coro_or_future, loop=loop) |     return ensure_future(coro_or_future, loop=loop) | ||||||
| 
 | 
 | ||||||
|  | # Silence DeprecationWarning: | ||||||
|  | globals()['async'] = async_ | ||||||
|  | async_.__name__ = 'async' | ||||||
|  | del async_ | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
| def ensure_future(coro_or_future, *, loop=None): | def ensure_future(coro_or_future, *, loop=None): | ||||||
|     """Wrap a coroutine or an awaitable in a future. |     """Wrap a coroutine or an awaitable in a future. | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yury Selivanov
						Yury Selivanov