8000 Fix format of dataclasses' `unsafe_hash` default value by Viicos · Pull Request #116532 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Fix format of dataclasses' unsafe_hash default value #116532

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 4 commits into from
Jun 12, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Apply feedback
  • Loading branch information
Viicos committed Jun 10, 2025
commit 0df1bda78e3c4465592492b1bc56bd662ad256f6
6 changes: 4 additions & 2 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
0