Skip to content

Commit c8e61d1

Browse files
authored
Merge pull request #165 from seperman/dev
v4-0-9: Fixing the bug for hashing custom unhashable objects
2 parents 974c5f3 + b2cf107 commit c8e61d1

File tree

11 files changed

+38
-13
lines changed

11 files changed

+38
-13
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ matrix:
77
- python: 3.6
88
- python: pypy3
99
- python: 3.7
10+
- python: 3.8
1011
dist: xenial
1112
sudo: true
1213

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# DeepDiff v 4.0.8
1+
# DeepDiff v 4.0.9
22

33
<!-- ![Downloads](https://img.shields.io/pypi/dm/deepdiff.svg?style=flat) -->
44
![Python Versions](https://img.shields.io/pypi/pyversions/deepdiff.svg?style=flat)
@@ -417,6 +417,7 @@ And then running
417417

418418
# ChangeLog
419419

420+
- v4-0-9: Fixing the bug for hashing custom unhashable objects
420421
- v4-0-8: Adding ignore_nan_inequality for float('nan')
421422
- v4-0-7: Hashing of the number 1 vs. True
422423
- v4-0-6: found a tiny bug in Python formatting of numbers in scientific notation. Added a workaround.

deepdiff/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""This module offers the DeepDiff, DeepSearch, grep and DeepHash classes."""
22
# flake8: noqa
3-
__version__ = '4.0.8'
3+
__version__ = '4.0.9'
44
import logging
55

66
if __name__ == '__main__':

deepdiff/deephash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def _hash(self, obj, parent, parents_ids=EMPTY_FROZENSET):
326326
elif isinstance(obj, Iterable):
327327
result = self._prep_iterable(obj=obj, parent=parent, parents_ids=parents_ids)
328328

329-
elif obj in {BoolObj.TRUE, BoolObj.FALSE}:
329+
elif obj == BoolObj.TRUE or obj == BoolObj.FALSE:
330330
result = 'bool:true' if obj is BoolObj.TRUE else 'bool:false'
331331
else:
332332
result = self._prep_obj(obj=obj, parent=parent, parents_ids=parents_ids)

deepdiff/diff.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,9 +478,9 @@ def __create_hashtable(self, t, level):
478478
)
479479
item_hash = hashes_all[item]
480480
except Exception as e: # pragma: no cover
481-
logger.warning("Can not produce a hash for %s."
482-
"Not counting this object.\n %s" %
483-
(level.path(), e))
481+
logger.error("Can not produce a hash for %s."
482+
"Not counting this object.\n %s" %
483+
(level.path(), e))
484484
else:
485485
if item_hash is unprocessed: # pragma: no cover
486486
logger.warning("Item %s was not processed while hashing "

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060
# built documents.
6161
#
6262
# The short X.Y version.
63-
version = '4.0.8'
63+
version = '4.0.9'
6464
# The full version, including alpha/beta/rc tags.
65-
release = '4.0.8'
65+
release = '4.0.9'
6666

6767
# The language for content autogenerated by Sphinx. Refer to documentation
6868
# for a list of supported languages.

docs/index.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
contain the root `toctree` directive.
55
66
7-
DeepDiff 4.0.8 documentation!
7+
DeepDiff 4.0.9 documentation!
88
=============================
99

1010
**DeepDiff: Deep Difference of dictionaries, iterables, strings and other objects. It will recursively look for all the changes.**
@@ -281,6 +281,7 @@ Indices and tables
281281
Changelog
282282
=========
283283

284+
- v4-0-9: Fixing the bug for hashing custom unhashable objects
284285
- v4-0-8: Adding ignore_nan_inequality for float('nan')
285286
- v4-0-7: Hashing of the number 1 vs. True
286287
- v4-0-6: found a tiny bug in Python formatting of numbers in scientific notation. Added a workaround.

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 4.0.8
2+
current_version = 4.0.9
33
commit = True
44
tag = True
55
tag_name = {new_version}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
if os.environ.get('USER', '') == 'vagrant':
1111
del os.link
1212

13-
version = '4.0.8'
13+
version = '4.0.9'
1414

1515

1616
def get_reqs(filename):

tests/__init__.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,12 @@ def __repr__(self):
1616
class CustomClassMisleadingRepr(CustomClass):
1717
def __str__(self):
1818
return "({}, {})".format(self.a, self.b)
19+
20+
21+
class CustomClass2:
22+
def __init__(self, prop1=None, prop2=None):
23+
self.prop1 = prop1 or []
24+
self.prop2 = prop2 or []
25+
26+
def __eq__(self, other):
27+
return self.__dict__ == other.__dict__

0 commit comments

Comments
 (0)