nebius/SWE-bench-extra huggingface dataset:
Repository: botify-labs/simpleflow

Issue:
json_dumps: handle sets
Like `ujson` does, we should dump sets as lists.

Comments:

Patch:
diff --git a/simpleflow/utils/json_tools.py b/simpleflow/utils/json_tools.py
index affa6117..14dd8c61 100644
--- a/simpleflow/utils/json_tools.py
+++ b/simpleflow/utils/json_tools.py
@@ -34,6 +34,8 @@ def _serialize_complex_object(obj):
         return str(obj)
     elif isinstance(obj, lazy_object_proxy.Proxy):
         return str(obj)
+    elif isinstance(obj, (set, frozenset)):
+        return list(obj)
     raise TypeError(
         "Type %s couldn't be serialized. This is a bug in simpleflow,"
         " please file a new issue on GitHub!" % type(obj))


Test patch:
diff --git a/tests/test_simpleflow/utils/test_json_dumps.py b/tests/test_simpleflow/utils/test_json_dumps.py
index 49c9d09e..31e8b7df 100644
--- a/tests/test_simpleflow/utils/test_json_dumps.py
+++ b/tests/test_simpleflow/utils/test_json_dumps.py
@@ -1,4 +1,5 @@
 import datetime
+import json
 import unittest
 
 import pytz
@@ -78,6 +79,20 @@ class TestJsonDumps(unittest.TestCase):
         actual = json_dumps(data)
         self.assertEqual(expected, actual)
 
+    def test_set(self):
+        data = [
+            {1, 2, 3},
+            frozenset([-1, -2, -3]),
+        ]
+        expected = [
+            [1, 2, 3],
+            [-1, -2, -3],
+        ]
+        actual = json_dumps(data)
+        actual = json.loads(actual)
+        self.assertEqual(sorted(expected[0]), sorted(actual[0]))
+        self.assertEqual(sorted(expected[1]), sorted(actual[1]))
+
 
 if __name__ == '__main__':
     unittest.main()