Vamsi-klu commented on code in PR #73081:
URL: https://github.com/apache/airflow/pull/73081#discussion_r4002487503


##########
providers/standard/src/airflow/providers/standard/operators/python.py:
##########
@@ -509,6 +509,12 @@ def __init__(
             raise ValueError(f"{type(self).__name__} only supports functions 
for python_callable arg")
         if inspect.isgeneratorfunction(python_callable):
             raise ValueError(f"{type(self).__name__} does not support using 
'yield' in python_callable")
+        # aexecute() awaits async callables in the worker process and never 
calls execute_callable().
+        if is_async_callable(python_callable):

Review Comment:
   is_async_callable (compat → SDK on 3.2+, local shim on older) checks 
coroutine functions and async __call__. It does not check 
inspect.isasyncgenfunction. An async def that yields still constructs.
   
   On the 3.1 shim it also does not inspect.unwrap, so a @functools.wraps 
wrapper around an async function slips through. Check async generators, and 
unwrap before the test, in this operator if compat will not. The existing test 
only covers async def f(): return 1.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to