bolkedebruin commented on code in PR #28980:
URL: https://github.com/apache/airflow/pull/28980#discussion_r1073821432


##########
airflow/utils/json.py:
##########
@@ -60,24 +60,30 @@ def default(self, o: Any) -> Any:
             if isinstance(data, dict) and DATA in data:
                 return data[DATA]
 
+        if isinstance(o, (set, frozenset)):
+            return list(o)
+
         try:
             data = serialize(o)
-            if isinstance(data, dict) and CLASSNAME in data:
-                # this is here for backwards compatibility
-                if (
-                    data[CLASSNAME].startswith("numpy")
-                    or data[CLASSNAME] == 
"kubernetes.client.models.v1_pod.V1Pod"
-                ):
-                    return data[DATA]
-            return data
         except TypeError:
-            raise
+            return super().default(o)
+
+        if isinstance(data, dict) and CLASSNAME in data:
+            # this is here for backwards compatibility
+            if (
+                data[CLASSNAME].startswith("numpy")
+                or data[CLASSNAME] == "kubernetes.client.models.v1_pod.V1Pod"
+            ):
+                return data[DATA]
+        return data
 
 
 class XComEncoder(json.JSONEncoder):
     """This encoder serializes any object that has attr, dataclass or a custom 
serializer."""
 
     def default(self, o: object) -> Any:
+        if isinstance(o, (set, frozenset)):

Review Comment:
   The challenge is that type information is lost here, so if we deserialize a 
set {1,2} becomes as list [1,2], which, while works now, might not work in the 
future. 



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