Skip to content
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

[REGRESSION] DDDType not hashable in icalendar 5 #487

Closed
tobixen opened this issue Nov 3, 2022 · 6 comments · Fixed by #492
Closed

[REGRESSION] DDDType not hashable in icalendar 5 #487

tobixen opened this issue Nov 3, 2022 · 6 comments · Fixed by #492

Comments

@tobixen
Copy link
Contributor

tobixen commented Nov 3, 2022

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

@niccokunzmann
Copy link
Member

niccokunzmann commented Nov 4, 2022

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?

@jacadzaca
Copy link
Collaborator

jacadzaca commented Nov 4, 2022

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.

@jacadzaca
Copy link
Collaborator

We've disscused implementing vDDDTypes.__hash__ here.

@niccokunzmann
Copy link
Member

niccokunzmann commented Nov 4, 2022 via email

@niccokunzmann
Copy link
Member

niccokunzmann commented Nov 10, 2022

I'll give it a go #492.

@niccokunzmann
Copy link
Member

Fixed in v5.0.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants