[REGRESSION] DDDType not hashable in icalendar 5
tobixen opened this issue · comments
Compare this:
>>> import icalendar
>>> import datetime
>>> icalendar.__version__
>>> icalendar.vDDDTypes(datetime.datetime(2022,10,10)).__hash__()
8729746249635
>>> icalendar.vDDDTypes(datetime.datetime(2022,10,10)).__hash__
<method-wrapper '__hash__' of vDDDTypes object at 0x7f08d6c97cd0>
>>>
with this:
>>> import icalendar
>>> import datetime
>>> icalendar.__version__
'5.0.1'
>>> icalendar.vDDDTypes(datetime.datetime(2022,10,10)).__hash__()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object is not callable
>>> icalendar.vDDDTypes(datetime.datetime(2022,10,10)).__hash__
I noticed tests failing because of this in another project - niccokunzmann/python-recurring-ical-events#99
Hm. It should be possible to add __hash__
and __eq__
. I wonder where it was removed.
It should not be None or am I mistaken? Is that something one does to not be hashed?
I couldn't find a commit where __hash__
would be removed from vDDDTypes class, but __hash__
might have disappeared due to #391. In python3 every class that overrides __eq__
has __hash__
set to None if no custom implementation of it is provided.
Thanks for the research!
I'll give it a go #492.
Fixed in v5.0.3.