From c537df54bc11c54383ba612ff4f4def08a970407 Mon Sep 17 00:00:00 2001 From: "Ilya V. Schurov" Date: Fri, 10 Feb 2023 20:46:41 +0100 Subject: [PATCH] Update dataclasses.astuple and dataclasses.asdict docstrings to reflect that they deep copy objects in the field values, according to the changes in the docs, see https://github.com/python/cpython/pull/26154 --- Lib/dataclasses.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py index 5c0257eba186d1..32006d445e1ea5 100644 --- a/Lib/dataclasses.py +++ b/Lib/dataclasses.py @@ -1284,7 +1284,7 @@ class C: If given, 'dict_factory' will be used instead of built-in dict. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: - tuples, lists, and dicts. + tuples, lists, and dicts. Other objects are copied with 'copy.deepcopy()'. """ if not _is_dataclass_instance(obj): raise TypeError("asdict() should be called on dataclass instances") @@ -1356,7 +1356,7 @@ class C: If given, 'tuple_factory' will be used instead of built-in tuple. The function applies recursively to field values that are dataclass instances. This will also look into built-in containers: - tuples, lists, and dicts. + tuples, lists, and dicts. Other objects are copied with 'copy.deepcopy()'. """ if not _is_dataclass_instance(obj):