mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	bpo-37658: Actually return result in race condition (GH-29202) (GH-29832)
(cherry picked from commit 934a826237)
Co-authored-by: Sam Bull <aa6bs0@sambull.org>
Co-authored-by: Sam Bull <aa6bs0@sambull.org>
			
			
This commit is contained in:
		
							parent
							
								
									031e2bb332
								
							
						
					
					
						commit
						99a9b34331
					
				
					 3 changed files with 13 additions and 36 deletions
				
			
		|  | @ -449,11 +449,9 @@ async def wait_for(fut, timeout, *, loop=None): | |||
| 
 | ||||
|         await _cancel_and_wait(fut, loop=loop) | ||||
|         try: | ||||
|             fut.result() | ||||
|             return fut.result() | ||||
|         except exceptions.CancelledError as exc: | ||||
|             raise exceptions.TimeoutError() from exc | ||||
|         else: | ||||
|             raise exceptions.TimeoutError() | ||||
| 
 | ||||
|     waiter = loop.create_future() | ||||
|     timeout_handle = loop.call_later(timeout, _release_waiter, waiter) | ||||
|  | @ -489,11 +487,9 @@ async def wait_for(fut, timeout, *, loop=None): | |||
|             # exception, we should re-raise it | ||||
|             # See https://bugs.python.org/issue40607 | ||||
|             try: | ||||
|                 fut.result() | ||||
|                 return fut.result() | ||||
|             except exceptions.CancelledError as exc: | ||||
|                 raise exceptions.TimeoutError() from exc | ||||
|             else: | ||||
|                 raise exceptions.TimeoutError() | ||||
|     finally: | ||||
|         timeout_handle.cancel() | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Miss Islington (bot)
						Miss Islington (bot)