Skip to content

Commit f8d4afb

Browse files
ischuroviritkatriel
authored andcommitted
pythongh-88071: Update docstrings of dataclass' astuple and asdict (python#101806)
Update dataclasses.astuple and dataclasses.asdict docstrings to reflect that they deep copy objects in the field values.
1 parent cdf9e3a commit f8d4afb

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
@@ -1281,7 +1281,7 @@ class C:
12811281
If given, 'dict_factory' will be used instead of built-in dict.
12821282
The function applies recursively to field values that are
12831283
dataclass instances. This will also look into built-in containers:
1284-
tuples, lists, and dicts.
1284+
tuples, lists, and dicts. Other objects are copied with 'copy.deepcopy()'.
12851285
"""
12861286
if not _is_dataclass_instance(obj):
12871287
raise TypeError("asdict() should be called on dataclass instances")
@@ -1353,7 +1353,7 @@ class C:
13531353
If given, 'tuple_factory' will be used instead of built-in tuple.
13541354
The function applies recursively to field values that are
13551355
dataclass instances. This will also look into built-in containers:
1356-
tuples, lists, and dicts.
1356+
tuples, lists, and dicts. Other objects are copied with 'copy.deepcopy()'.
13571357
"""
13581358

13591359
if not _is_dataclass_instance(obj):

0 commit comments

Comments
 (0)