Skip to content

Fix period raising exceptions in __eq__()#380

Open
gnattishness wants to merge 1 commit into
python-pendulum:masterfrom
gnattishness:fix_eq_exception
Open

Fix period raising exceptions in __eq__()#380
gnattishness wants to merge 1 commit into
python-pendulum:masterfrom
gnattishness:fix_eq_exception

Conversation

@gnattishness

Copy link
Copy Markdown

Period can raise an AttributeError when being compared with other types.

e.g.

>>> import pendulum
>>> p = pendulum.now() - pendulum.yesterday()
>>> p == None
AttributeError: 'NoneType' object has no attribute 'start'
>>> # should return False

This fix retains the same duck-typing capabilities, but using isinstance() is another option.

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 this pull request may close these issues.

1 participant