Skip to content

Commit c537df5

Browse files
authored
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 python#26154
1 parent 0a7936a commit c537df5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/dataclasses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ class C:
12841284
If given, 'dict_factory' will be used instead of built-in dict.
12851285
The function applies recursively to field values that are
12861286
dataclass instances. This will also look into built-in containers:
1287-
tuples, lists, and dicts.
1287+
tuples, lists, and dicts. Other objects are copied with 'copy.deepcopy()'.
12881288
"""
12891289
if not _is_dataclass_instance(obj):
12901290
raise TypeError("asdict() should be called on dataclass instances")
@@ -1356,7 +1356,7 @@ class C:
13561356
If given, 'tuple_factory' will be used instead of built-in tuple.
13571357
The function applies recursively to field values that are
13581358
dataclass instances. This will also look into built-in containers:
1359-
tuples, lists, and dicts.
1359+
tuples, lists, and dicts. Other objects are copied with 'copy.deepcopy()'.
13601360
"""
13611361

13621362
if not _is_dataclass_instance(obj):

0 commit comments

Comments
 (0)