Skip to content

BUG: Fixup f2py's handling a very little bit#23093

Merged
charris merged 1 commit intonumpy:mainfrom
seberg:f2py-error-handling-is-a-mess
Jan 25, 2023
Merged

BUG: Fixup f2py's handling a very little bit#23093
charris merged 1 commit intonumpy:mainfrom
seberg:f2py-error-handling-is-a-mess

Conversation

@seberg
Copy link
Copy Markdown
Member

@seberg seberg commented Jan 25, 2023

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.

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.
" -- expected str|bytes|sequence-of-str-or-bytes, got ");
f2py_describe(obj, mess + strlen(mess));
PyErr_SetString(err, mess);
Py_DECREF(err);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prolly not necessary, but owning a reference seemed cleaner if we don't know where it came from.

@seberg seberg linked an issue Jan 25, 2023 that may be closed by this pull request
f2py_describe(obj, mess + strlen(mess));
PyErr_SetString(err, mess);
}
PyErr_SetString(err, mess);
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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...

}
else {
Py_INCREF(err);
PyErr_Clear();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The missing clear is the CI failure.

@charris charris merged commit 1bb932f into numpy:main Jan 25, 2023
@charris
Copy link
Copy Markdown
Member

charris commented Jan 25, 2023

Thanks Sebastian.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

debug CI job is crashing

3 participants