mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
[3.14] Fix presentation of dataclasses' unsafe_hash
default value (GH-116532) (#135416)
Fix presentation of dataclasses' `unsafe_hash` default value (GH-116532)
(cherry picked from commit 71f5fafdfb
)
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
parent
98136ddb0e
commit
4a30154fd2
1 changed files with 5 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue