diff --git a/HISTORY.rst b/HISTORY.rst index 05b76f13..f048f1b7 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -16,6 +16,9 @@ History (`#217 `_) * Fix structuring of ``enum.Enum`` instances in ``typing.Literal`` types. (`#231 `_) +* Fix unstructuring all tuples - unannotated, variable-length, homogenous and heterogenous - to `list`. + (`#226 `_) + 1.10.0 (2022-01-04) ------------------- diff --git a/src/cattr/_compat.py b/src/cattr/_compat.py index 141fa537..1d64eed9 100644 --- a/src/cattr/_compat.py +++ b/src/cattr/_compat.py @@ -277,6 +277,7 @@ def is_sequence(type: Any) -> bool: TypingSequence, TypingMutableSequence, AbcMutableSequence, + Tuple, tuple, ) or ( diff --git a/src/cattr/converters.py b/src/cattr/converters.py index c5450365..92fadbef 100644 --- a/src/cattr/converters.py +++ b/src/cattr/converters.py @@ -773,7 +773,7 @@ def gen_unstructure_iterable(self, cl: Any, unstructure_to=None): def gen_unstructure_hetero_tuple(self, cl: Any, unstructure_to=None): unstructure_to = self._unstruct_collection_overrides.get( - get_origin(cl) or cl, unstructure_to or tuple + get_origin(cl) or cl, unstructure_to or list ) h = make_hetero_tuple_unstructure_fn(cl, self, unstructure_to=unstructure_to) self._unstructure_func.register_cls_list([(cl, h)], direct=True)