ashb commented on code in PR #29445: URL: https://github.com/apache/airflow/pull/29445#discussion_r1102828840
########## airflow/decorators/base.py: ########## @@ -296,7 +297,20 @@ class _TaskDecorator(ExpandableFactory, Generic[FParams, FReturn, OperatorSubcla @multiple_outputs.default def _infer_multiple_outputs(self): try: - return_type = typing_extensions.get_type_hints(self.function).get("return", Any) + # We only care about the return annotation, not anything about the parameters + def fake(): + ... + + fake.__annotations__ = {"return": self.function.__annotations__["return"]} + + return_type = typing_extensions.get_type_hints(fake, self.function.__globals__).get("return", Any) + except NameError as e: + warnings.warn( + "Cannot infer multiple_outputs with forward type references that are not imported. " Review Comment: Oh yes good call. -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org