Skip to content

Conversation

@jkeyes
Copy link
Contributor

@jkeyes jkeyes commented Aug 21, 2016

A comparison between a Pendulum object and None raises the following error:

>>> import pendulum
>>> pendulum.now() == None
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/vagrant/.pyenv/versions/server/lib/python2.7/site-packages/pendulum/pendulum.py", line 1129, in __eq__
    return self._datetime == self._get_datetime(other)
  File "/home/vagrant/.pyenv/versions/server/lib/python2.7/site-packages/pendulum/pendulum.py", line 2159, in _get_datetime
    raise ValueError('Invalid datetime "{}"'.format(value))
ValueError: Invalid datetime "None"

To fix, I modified _get_datetime to return None if value is None.

@sdispater sdispater merged commit a616a02 into python-pendulum:master Aug 21, 2016
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.

2 participants