forked from goodboy/tractor
				
			Facepalm, re-raise captured `asyncio` task error
							parent
							
								
									b376b7cd32
								
							
						
					
					
						commit
						7a65165279
					
				| 
						 | 
					@ -102,6 +102,7 @@ def _run_asyncio_task(
 | 
				
			||||||
        except BaseException as err:
 | 
					        except BaseException as err:
 | 
				
			||||||
            aio_err = err
 | 
					            aio_err = err
 | 
				
			||||||
            from_aio._err = aio_err
 | 
					            from_aio._err = aio_err
 | 
				
			||||||
 | 
					            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:
 | 
				
			||||||
| 
						 | 
					@ -119,9 +120,11 @@ def _run_asyncio_task(
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        raise TypeError(f"No support for invoking {coro}")
 | 
					        raise TypeError(f"No support for invoking {coro}")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def cancel_trio(task):
 | 
					    def cancel_trio(task) -> None:
 | 
				
			||||||
        """Cancel the calling ``trio`` task on error.
 | 
					        '''
 | 
				
			||||||
        """
 | 
					        Cancel the calling ``trio`` task on error.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        '''
 | 
				
			||||||
        nonlocal aio_err
 | 
					        nonlocal aio_err
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            aio_err = task.exception()
 | 
					            aio_err = task.exception()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue