-
Notifications
You must be signed in to change notification settings - Fork 523
Description
Hey there,
Thanks for a great package!
We encountered an issue with 2.7.0 release and exactly this change (float to Decimal):
https://github.com/dateutil/dateutil/pull/570/files#diff-4b65e7edb2b73639d2d3360fa8d05343R937
Before release it was float and producing ValueError:
>>> float('TEST')
ValueError: could not convert string to float: 'TEST'
After release, same operation goes with Decimal, which produces a different error:
>>> Decimal('TEST')
decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]
I am not 100% familiar with dateutil code, but I see, that ValueError was covered in dateutil.parser._parser.parser#_parse here: https://github.com/dateutil/dateutil/blob/master/dateutil/parser/_parser.py#L689-L825
But now that piece is raising decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>] which is not covered at all and breaking the code, that uses it.
What shall we do in that case? Shall we wrap it in try/except like it says in leftovers TODO comment?
My environment (just in case):
>>> import dateutil; print(dateutil.__version__)
2.7.0
13:16 $ python --version
Python 3.6.4
Upd. Code example with failing parser:
>dateutil.parser.parse('1: test')
decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]
>dateutil.parser.parse('9999: 12, test')
decimal.InvalidOperation: [<class 'decimal.ConversionSyntax'>]