BUG: Fixup f2py's handling a very little bit#23093
Merged
charris merged 1 commit intonumpy:mainfrom Jan 25, 2023
Merged
Conversation
This clears the error holding only to the type. Since in the other path the errmessage seemed completely uninitialized, I opted to just ignore it entirely and keep the old error. I could fathom to use error chaining here, but overall, I am not even sure that chaining makes even sense for these errors. This fix is meant to be minimal (the second one, I just noticed randomly), it does not make this code clean.
seberg
commented
Jan 25, 2023
| " -- expected str|bytes|sequence-of-str-or-bytes, got "); | ||
| f2py_describe(obj, mess + strlen(mess)); | ||
| PyErr_SetString(err, mess); | ||
| Py_DECREF(err); |
Member
Author
There was a problem hiding this comment.
prolly not necessary, but owning a reference seemed cleaner if we don't know where it came from.
seberg
commented
Jan 25, 2023
| f2py_describe(obj, mess + strlen(mess)); | ||
| PyErr_SetString(err, mess); | ||
| } | ||
| PyErr_SetString(err, mess); |
Member
Author
There was a problem hiding this comment.
mess is uninitialized? So better not use it at all. The other places compose a new message outside the branch. But I am not convinced that is even useful, so...
seberg
commented
Jan 25, 2023
| } | ||
| else { | ||
| Py_INCREF(err); | ||
| PyErr_Clear(); |
Member
Author
There was a problem hiding this comment.
The missing clear is the CI failure.
Member
|
Thanks Sebastian. |
This was referenced Feb 21, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This clears the error holding only to the type. Since in the other path the errmessage seemed completely uninitialized, I opted to just ignore it entirely and keep the old error.
I could fathom to use error chaining here, but overall, I am not even sure that chaining makes even sense for these errors. This fix is meant to be minimal (the second one, I just noticed randomly), it does not make this code clean.