[Python-checkins] Fixed incorrect default value for dataclass unsafe_hash. (GH-5949) (GH-5950)

Eric V. Smith webhook-mailer at python.org
Thu Mar 1 08:30:18 EST 2018


https://github.com/python/cpython/commit/398242a5b61067e3171b11964229fba87a251ef7
commit: 398242a5b61067e3171b11964229fba87a251ef7
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Eric V. Smith <ericvsmith at users.noreply.github.com>
date: 2018-03-01T08:30:13-05:00
summary:

Fixed incorrect default value for dataclass unsafe_hash. (GH-5949) (GH-5950)

(cherry picked from commit 5da8cfb838fa1bf3529c085c6dce1adf3d1eaf62)

Co-authored-by: Eric V. Smith <ericvsmith at users.noreply.github.com>

files:
M Lib/dataclasses.py

diff --git a/Lib/dataclasses.py b/Lib/dataclasses.py
index 54478fec93df..b55a497db302 100644
--- a/Lib/dataclasses.py
+++ b/Lib/dataclasses.py
@@ -745,7 +745,7 @@ def _process_class(cls, repr, eq, order, unsafe_hash, init, frozen):
 #  underscore. The presence of _cls is used to detect if this
 #  decorator is being called with parameters or not.
 def dataclass(_cls=None, *, init=True, repr=True, eq=True, order=False,
-              unsafe_hash=None, frozen=False):
+              unsafe_hash=False, frozen=False):
     """Returns the same class as was passed in, with dunder methods
     added based on the fields defined in the class.
 
@@ -880,7 +880,7 @@ def _astuple_inner(obj, tuple_factory):
 
 
 def make_dataclass(cls_name, fields, *, bases=(), namespace=None, init=True,
-                   repr=True, eq=True, order=False, unsafe_hash=None,
+                   repr=True, eq=True, order=False, unsafe_hash=False,
                    frozen=False):
     """Return a new dynamically created dataclass.
 



More information about the Python-checkins mailing list