summaryrefslogtreecommitdiffstats
path: root/Lib/dataclasses.py
diff options
context:
space:
mode:
authorIlya V. Schurov <ilya@schurov.com>2023-03-11 00:27:41 (GMT)
committerGitHub <noreply@github.com>2023-03-11 00:27:41 (GMT)
commit767d3a8f6f2f94daa15ad3759d0ecdf4c009b7ab (patch)
tree22f7371a6614f176dfc76fa21a39ad37f81e6c06 /Lib/dataclasses.py
parentb48be8fa18518583abb21bf6e4f5d7e4b5c9d7b2 (diff)
downloadcpython-767d3a8f6f2f94daa15ad3759d0ecdf4c009b7ab.zip
cpython-767d3a8f6f2f94daa15ad3759d0ecdf4c009b7ab.tar.gz
cpython-767d3a8f6f2f94daa15ad3759d0ecdf4c009b7ab.tar.bz2
gh-88071: Update docstrings of dataclass' astuple and asdict (#101806)
Update dataclasses.astuple and dataclasses.asdict docstrings to reflect that they deep copy objects in the field values.
Diffstat (limited to 'Lib/dataclasses.py')
-rw-r--r--Lib/dataclasses.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index 24f3779..f4617b1 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -1281,7 +1281,7 @@ def asdict(obj, *, dict_factory=dict):
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")
@@ -1353,7 +1353,7 @@ def astuple(obj, *, tuple_factory=tuple):
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):