Skip to content

[3.14] Fix presentation of dataclasses' unsafe_hash default value (GH-116532) #135416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 12, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,11 @@ 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 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``.

:meth:`!__hash__` is used by built-in :meth:`hash`, and when objects are
added to hashed collections such as dictionaries and sets. Having a
Expand Down
Loading