summaryrefslogtreecommitdiff
path: root/dateutil
diff options
context:
space:
mode:
authorPaul Ganssle <paul@ganssle.io>2020-01-02 12:59:10 -0500
committerGitHub <noreply@github.com>2020-01-02 12:59:10 -0500
commit21fe6e9669191b413e59cd9abd22610191575c1f (patch)
treecb0931a0d9b4b2d9ef3c44bd9e9b827647d4e39d /dateutil
parentf6c6d5cb97ce460c9510846bf14e945b2b16ead0 (diff)
parenta33287920ce8c3cbf99bf50b858e6081750aa0e8 (diff)
downloaddateutil-git-21fe6e9669191b413e59cd9abd22610191575c1f.tar.gz
Merge pull request #987 from eastface/issue_981
Fix TypeError in parser's error-wrapping logic
Diffstat (limited to 'dateutil')
-rw-r--r--dateutil/parser/_parser.py2
-rw-r--r--dateutil/test/test_parser.py4
2 files changed, 5 insertions, 1 deletions
diff --git a/dateutil/parser/_parser.py b/dateutil/parser/_parser.py
index 458aa6a..7fcfa54 100644
--- a/dateutil/parser/_parser.py
+++ b/dateutil/parser/_parser.py
@@ -654,7 +654,7 @@ class parser(object):
try:
ret = self._build_naive(res, default)
except ValueError as e:
- six.raise_from(ParserError(e.args[0] + ": %s", timestr), e)
+ six.raise_from(ParserError(str(e) + ": %s", timestr), e)
if not ignoretz:
ret = self._build_tzaware(ret, res, tzinfos)
diff --git a/dateutil/test/test_parser.py b/dateutil/test/test_parser.py
index 726156c..605705e 100644
--- a/dateutil/test/test_parser.py
+++ b/dateutil/test/test_parser.py
@@ -743,6 +743,10 @@ class TestOutOfBounds(object):
with pytest.raises(ParserError):
parse("Feb 30, 2007")
+ def test_illegal_month_error(self):
+ with pytest.raises(ParserError):
+ parse("0-100")
+
def test_day_sanity(self, fuzzy):
dstr = "2014-15-25"
with pytest.raises(ParserError):