From bd1b078658a426206ad06e6421a490d9b13dc640 Mon Sep 17 00:00:00 2001 From: Victorien <65306057+Viicos@users.noreply.github.com> Date: Sat, 9 Mar 2024 09:10:26 +0100 Subject: [PATCH 1/4] Fix format of dataclasses' `unsafe_hash` default value --- Doc/library/dataclasses.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index f18c7cc9c02da6..d738f32b64d20a 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -121,7 +121,7 @@ Module contents :meth:`!__le__`, :meth:`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is raised. - - *unsafe_hash*: If ``False`` (the default), a :meth:`~object.__hash__` method + - *unsafe_hash*: If false (the default), a :meth:`~object.__hash__` method is generated according to how *eq* and *frozen* are set. :meth:`!__hash__` is used by built-in :meth:`hash`, and when objects are From 0df1bda78e3c4465592492b1bc56bd662ad256f6 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Tue, 10 Jun 2025 10:30:33 +0200 Subject: [PATCH 2/4] Apply feedback --- Doc/library/dataclasses.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index d738f32b64d20a..54afb76bd0837f 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -121,8 +121,10 @@ Module contents :meth:`!__le__`, :meth:`!__gt__`, or :meth:`!__ge__`, then :exc:`TypeError` is raised. - - *unsafe_hash*: If false (the default), a :meth:`~object.__hash__` method - is generated according to how *eq* and *frozen* are set. + - *unsafe_hash*: If true, force ``dataclasses`` to create a + :meth:`~object.__hash__` method, even when it may not be safe to do so. + Otherwise, generate a :meth:`~object.__hash__` method according to how + *eq* and *frozen* are set. The default value is ``False``. :meth:`!__hash__` is used by built-in :meth:`hash`, and when objects are added to hashed collections such as dictionaries and sets. Having a From efccb4b2472fd7acd772546ccca1b4a56dead3d4 Mon Sep 17 00:00:00 2001 From: Viicos <65306057+Viicos@users.noreply.github.com> Date: Wed, 11 Jun 2025 17:51:48 +0200 Subject: [PATCH 3/4] Feedback --- Doc/library/dataclasses.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 54afb76bd0837f..985ecaf3b2b634 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -122,7 +122,7 @@ Module contents :exc:`TypeError` is raised. - *unsafe_hash*: If true, force ``dataclasses`` to create a - :meth:`~object.__hash__` method, even when it may not be safe to do so. + :meth:`~object.__hash__` method, even though it may not be safe to do so. Otherwise, generate a :meth:`~object.__hash__` method according to how *eq* and *frozen* are set. The default value is ``False``. From 433404de4a33b27eff69ef6fb121944f2f7a6142 Mon Sep 17 00:00:00 2001 From: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Date: Wed, 11 Jun 2025 19:38:41 +0100 Subject: [PATCH 4/4] Update Doc/library/dataclasses.rst style --- Doc/library/dataclasses.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Doc/library/dataclasses.rst b/Doc/library/dataclasses.rst index 985ecaf3b2b634..299c8aa399c25c 100644 --- a/Doc/library/dataclasses.rst +++ b/Doc/library/dataclasses.rst @@ -124,7 +124,8 @@ Module contents - *unsafe_hash*: If true, force ``dataclasses`` to create a :meth:`~object.__hash__` method, even though it may not be safe to do so. Otherwise, generate a :meth:`~object.__hash__` method according to how - *eq* and *frozen* are set. The default value is ``False``. + *eq* and *frozen* are set. + The default value is ``False``. :meth:`!__hash__` is used by built-in :meth:`hash`, and when objects are added to hashed collections such as dictionaries and sets. Having a