New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
parser raises TypeError
in wrapper logic
#981
Comments
We also had an issue with this after upgrade to 2.8.1: https://gitlab.com/datadrivendiscovery/common-primitives/issues/119 Our example:
|
This comment has been minimized.
This comment has been minimized.
Please do not add "I'm affected by this" or "+1" comments here. I've outlined the solution in the first post, I would be happy to review and merge a PR fixing it, but I have a large backlog. |
…ested. Guard against an integer value in ValueError args. This is known to occur with IllegalMonthError.
In attempting to pass-through the string representation of an exception we are wrapping, we made the erroneous assumption that `args[0]` would always be a string (or something that can concatenate cleanly with a string). This turns out not to be the case with `IllegalMonthError`, where it is an integer, so to avoid raising an erroneous `TypeError`, we first convert the wrapped exception to a string. See GH issue dateutil#981.
In attempting to pass-through the string representation of an exception we are wrapping, we made the erroneous assumption that `args[0]` would always be a string (or something that can concatenate cleanly with a string). This turns out not to be the case with `IllegalMonthError`, where it is an integer, so to avoid raising an erroneous `TypeError`, we first convert the wrapped exception to a string. See GH issue dateutil#981.
@pganssle not trying to say +1 or something, but where can I find your solution in the "first post"? |
Apparently sometimes the parser catches a type of
ValueError
other than the ones we raise - specificallyIllegalMonthError
, which takes as an argument something other than a string. Minimal reproducer:This raises the following error:
The core of the issue is this line:
Since
e.args[0]
is apparently occasionally an integer.I guess we can solve this this way:
This will need a regression test. This is apparently the cause of matplotlib/matplotlib#15726.
The text was updated successfully, but these errors were encountered: