File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,11 @@ def _iter_check_list(lst):
111
111
# We have to make a copy, as we don't want to touch to the original list
112
112
# A deepcopy isn't necessary as it is already recursive.
113
113
lst_copy = copy .copy (lst )
114
+ if isinstance (lst , tuple ):
115
+ # NOTE: Sometimes a tuple can pass through this function. As a tuple
116
+ # is immutable, we convert it to a list to be able to modify it.
117
+ # It's ok as it is a copy.
118
+ lst_copy = list (lst_copy )
114
119
for i , el in enumerate (lst ):
115
120
if not isinstance (lst , tuple ):
116
121
lst_copy [i ] = self ._handle_already_processed (
Original file line number Diff line number Diff line change @@ -108,3 +108,9 @@ def test_JSON_with_big_np_array():
108
108
a = np .zeros ((1000 , 1000 ))
109
109
o_ser = hashing .get_json (a )
110
110
assert "TRUNCATED ARRAY" in o_ser
111
+
112
+
113
+ def test_JSON_with_tuple ():
114
+ o = [(1 , [1 ])]
115
+ o_ser = hashing .get_json (o )
116
+ assert o_ser == "[[1, [1]]]"
You can’t perform that action at this time.
0 commit comments