amoghrajesh commented on code in PR #66002:
URL: https://github.com/apache/airflow/pull/66002#discussion_r3181462120


##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -1633,7 +1633,19 @@ def defer_task(self, session: Session = NEW_SESSION) -> 
bool:
             assert isinstance(self.task, Operator)
 
         if start_trigger_args := self.start_trigger_args:
-            trigger_kwargs = start_trigger_args.trigger_kwargs or {}
+            from airflow.serialization.enums import Encoding
+
+            def _normalize(d: Any) -> Any:
+                # trigger_kwargs arrives with Encoding enum keys from 
BaseSerialization.
+                # On Python 3.10, str(Encoding.TYPE) returns "Encoding.TYPE" 
not "__type",
+                # so we convert enum keys to their values before passing to 
serde.serialize.
+                if isinstance(d, dict):
+                    return {
+                        (k.value if isinstance(k, Encoding) else str(k)): 
_normalize(v) for k, v in d.items()
+                    }
+                return d
+
+            trigger_kwargs = _normalize(start_trigger_args.trigger_kwargs or 
{})

Review Comment:
   Good catch. Applied _stringify_encoding_keys to next_kwargs symmetrically 
and added a test too.
   



-- 
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