-
Notifications
You must be signed in to change notification settings - Fork 55
Description
The codebase currently lacks NULL checks after calls to PyTuple_Pack, which can return NULL on error. This issue poses a bug risk as it can lead to unexpected behavior or crashes if the error is not handled properly.
The specific instance mentioned is in the code where PyTuple_Pack is used without checking for a NULL return value. The suggested fix is to add a NULL check immediately after the PyTuple_Pack call, as follows:
PyObject *tuple = PyTuple_Pack(2, path, retval);
if (tuple == NULL) {
return NULL;
}Additionally, there are other files such as kvitems_basecoro.c and parse_basecoro.c that also lack these checks. It is recommended to perform a comprehensive review and update all instances where PyTuple_Pack is used without a NULL check across the codebase. A separate commit addressing all these instances would be beneficial to ensure consistency and robustness in error handling.
I created this issue for @wodny from #127 (comment).
Tips and commands
Interacting with Sourcery
- Generate a plan of action: Comment
@sourcery-ai planon this issue. - Generate a pull request for this issue: Comment
@sourcery-ai developto
generate a PR that addresses this issue.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.