From a2e8a05c3b64be558b38bdef45100817709d3061 Mon Sep 17 00:00:00 2001 From: v01dxyz Date: Sun, 1 Mar 2026 11:59:04 +0100 Subject: [PATCH] gh-145369: document dataclass could possibly mutate provided field objects (#145369) --- Doc/library/dataclasses.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 447f05e67d8418..1d4390ce3ce3f6 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -254,6 +254,11 @@ Module contents used because ``None`` is a valid value for some parameters with a distinct meaning. No code should directly use the :const:`MISSING` value. + :deco:`dataclass` is free to possibly mutate the provided field + objects. As such, do not use the same object for multiple fields + even if they share the same properties. If so, the updated class is + not ensured to be well-functioning. + The parameters to :func:`!field` are: - *default*: If provided, this will be the default value for this