Reverse the order for asyncio cancelleds? I dunno why
							parent
							
								
									04c0eda69d
								
							
						
					
					
						commit
						8704664719
					
				|  | @ -72,6 +72,7 @@ def _run_asyncio_task( | ||||||
|     aio_err: Optional[BaseException] = None |     aio_err: Optional[BaseException] = None | ||||||
| 
 | 
 | ||||||
|     async def wait_on_coro_final_result( |     async def wait_on_coro_final_result( | ||||||
|  | 
 | ||||||
|         to_trio: trio.MemorySendChannel, |         to_trio: trio.MemorySendChannel, | ||||||
|         coro: Awaitable, |         coro: Awaitable, | ||||||
|         aio_task_complete: trio.Event, |         aio_task_complete: trio.Event, | ||||||
|  | @ -89,6 +90,7 @@ def _run_asyncio_task( | ||||||
|             aio_err = err |             aio_err = err | ||||||
|             from_aio._err = aio_err |             from_aio._err = aio_err | ||||||
|             raise |             raise | ||||||
|  | 
 | ||||||
|         finally: |         finally: | ||||||
|             aio_task_complete.set() |             aio_task_complete.set() | ||||||
|             if result != orig and aio_err is None: |             if result != orig and aio_err is None: | ||||||
|  | @ -112,15 +114,17 @@ def _run_asyncio_task( | ||||||
|         try: |         try: | ||||||
|             aio_err = task.exception() |             aio_err = task.exception() | ||||||
|         except CancelledError as cerr: |         except CancelledError as cerr: | ||||||
|             log.exception("infected task was cancelled") |             log.cancel("infected task was cancelled") | ||||||
|             # raise |             from_aio._err = cerr | ||||||
|             aio_err = cerr |  | ||||||
| 
 |  | ||||||
|         if aio_err: |  | ||||||
|             log.exception(f"infected task errorred with {type(aio_err)}") |  | ||||||
|             from_aio._err = aio_err |  | ||||||
|             from_aio.close() |             from_aio.close() | ||||||
|             cancel_scope.cancel() |             cancel_scope.cancel() | ||||||
|  |         else: | ||||||
|  |             if aio_err is not None: | ||||||
|  |                 log.exception(f"infected task errorred:") | ||||||
|  |                 from_aio._err = aio_err | ||||||
|  |                 # order is opposite here | ||||||
|  |                 cancel_scope.cancel() | ||||||
|  |                 from_aio.close() | ||||||
| 
 | 
 | ||||||
|     task.add_done_callback(cancel_trio) |     task.add_done_callback(cancel_trio) | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue