diff --git a/manim/utils/hashing.py b/manim/utils/hashing.py index ee79effef3..471b01893a 100644 --- a/manim/utils/hashing.py +++ b/manim/utils/hashing.py @@ -111,6 +111,11 @@ def _iter_check_list(lst): # We have to make a copy, as we don't want to touch to the original list # A deepcopy isn't necessary as it is already recursive. lst_copy = copy.copy(lst) + if isinstance(lst, tuple): + # NOTE: Sometimes a tuple can pass through this function. As a tuple + # is immutable, we convert it to a list to be able to modify it. + # It's ok as it is a copy. + lst_copy = list(lst_copy) for i, el in enumerate(lst): if not isinstance(lst, tuple): lst_copy[i] = self._handle_already_processed( diff --git a/tests/test_hashing.py b/tests/test_hashing.py index aa295415ee..2a839dd20c 100644 --- a/tests/test_hashing.py +++ b/tests/test_hashing.py @@ -108,3 +108,9 @@ def test_JSON_with_big_np_array(): a = np.zeros((1000, 1000)) o_ser = hashing.get_json(a) assert "TRUNCATED ARRAY" in o_ser + + +def test_JSON_with_tuple(): + o = [(1, [1])] + o_ser = hashing.get_json(o) + assert o_ser == "[[1, [1]]]"