-
Notifications
You must be signed in to change notification settings - Fork 523
Closed
Milestone
Description
Hi there!
We discovered a problem with the latest release (2.7.2):
import dateutil
dateutil.parser.parse('Nan')
Is raising InvalidOperation with a traceback:
Details
Traceback (most recent call last)
<ipython-input-8-aea1750fc455> in <module>()
----> 1 dateutil.parser.parse('Nan')
~/.virtualenvs/backend/lib/python3.6/site-packages/dateutil/parser/_parser.py in parse(timestr, parserinfo, **kwargs)
1310 return parser(parserinfo).parse(timestr, **kwargs)
1311 else:
-> 1312 return DEFAULTPARSER.parse(timestr, **kwargs)
1313
1314
~/.virtualenvs/backend/lib/python3.6/site-packages/dateutil/parser/_parser.py in parse(self, timestr, default, ignoretz, tzinfos, **kwargs)
602 second=0, microsecond=0)
603
--> 604 res, skipped_tokens = self._parse(timestr, **kwargs)
605
606 if res is None:
~/.virtualenvs/backend/lib/python3.6/site-packages/dateutil/parser/_parser.py in _parse(self, timestr, dayfirst, yearfirst, fuzzy, fuzzy_with_tokens)
699 if value is not None:
700 # Numeric token
--> 701 i = self._parse_numeric_token(l, i, info, ymd, res, fuzzy)
702
703 # Check weekday
~/.virtualenvs/backend/lib/python3.6/site-packages/dateutil/parser/_parser.py in _parse_numeric_token(self, tokens, idx, info, ymd, res, fuzzy)
948 else:
949 # Year, month or day
--> 950 ymd.append(value)
951 idx += 1
952
~/.virtualenvs/backend/lib/python3.6/site-packages/dateutil/parser/_parser.py in append(self, val, label)
428 raise ValueError(label)
429 label = 'Y'
--> 430 elif val > 100:
431 self.century_specified = True
432 if label not in [None, 'Y']: # pragma: no cover
InvalidOperation: [<class 'decimal.InvalidOperation'>]
My environment:
>>> import dateutil; print(dateutil.__version__)
2.7.2
13:16 $ python --version
Python 3.6.4
I am not sure how to properly tackle this problem yet. If you are having busy times with the other bugs, please, point me to where it would be better to handle this exception and I will provide a bugfix!
Thank you for the package!