Skip to content

Commit

Permalink
gh-88071: Update docstrings of dataclass' astuple and asdict (#101806)
Browse files Browse the repository at this point in the history
Update dataclasses.astuple and dataclasses.asdict docstrings to reflect that they deep copy objects in the field values.
  • Loading branch information
ischurov committed Mar 11, 2023
1 parent b48be8f commit 767d3a8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Lib/dataclasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,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")
Expand Down Expand Up @@ -1353,7 +1353,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):
Expand Down

0 comments on commit 767d3a8

Please sign in to comment.