You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Check return value of Python functions that can fail #139
This issue is about checking error codes of python functions. Here is an example of error checking done correctly: PyArg_ParseTuple(...) can fail, and if it does the function should return NULL right away.
if (!PyArg_ParseTuple(args, "OOOO", &pynode, &pymsg_type, &pytopic, &pyqos_profile)) {
returnNULL;
}
Here is an example of what should be fixed: PyList_New() can set an exception and return NULL, so pylist needs to be checked before calling PyList_SET_ITEM() with it.
@db118 See the section "Building from source" for instructions to build this library. It lists the dependencies, as well as shows how to build the other ros 2 packages this one depends on. Once you've built everything once, you can build and test just this backage with colcon build --packages-select rclpy and colcon test --event-handlers console_direct+ --packages-select rclpy.
I don't think I understand the question about swtiching NULL error checking; both of those look fine to me.
Given our recent switch to pybind11 (which gets completed with #814), I actually think this issue is mostly obsolete. @sloretz what do you think? Should we just close this one out?
Activity
darrylbalderas commentedon Aug 18, 2018
First time contributing to open source and interested in learning more about how to fix this issue.
sloretz commentedon Sep 6, 2018
Hi @db118 ,
This issue is about checking error codes of python functions. Here is an example of error checking done correctly:
PyArg_ParseTuple(...)can fail, and if it does the function should returnNULLright away.rclpy/rclpy/src/rclpy/_rclpy.c
Lines 1550 to 1552 in 62012d3
Here is an example of what should be fixed:
PyList_New()can set an exception and returnNULL, sopylistneeds to be checked before callingPyList_SET_ITEM()with it.rclpy/rclpy/src/rclpy/_rclpy.c
Lines 1693 to 1697 in 62012d3
A good first PR would fix one instance of a function that can fail not being checked.
darrylbalderas commentedon Sep 7, 2018
@sloretz Ahhh that make sense. Also I don't see a requirements.txt. Is there certain python libraries I need to get this up and running.
darrylbalderas commentedon Sep 7, 2018
@sloretz
Do you want me to switch this null error checking
rclpy/rclpy/src/rclpy/_rclpy.c
Lines 3642 to 3645 in 62012d3
to this implementation instead
rclpy/rclpy/src/rclpy/_rclpy.c
Lines 1550 to 1552 in 62012d3
sloretz commentedon Sep 10, 2018
@db118 See the section "Building from source" for instructions to build this library. It lists the dependencies, as well as shows how to build the other ros 2 packages this one depends on. Once you've built everything once, you can build and test just this backage with
colcon build --packages-select rclpyandcolcon test --event-handlers console_direct+ --packages-select rclpy.I don't think I understand the question about swtiching
NULLerror checking; both of those look fine to me.suab321321 commentedon Jun 23, 2019
I would like to help with this one @sloretz should I proceed?
pr-db commentedon Aug 12, 2021
@sloretz Hello, I'm new to open source and love working with ros. How can I approach this issue?
clalancette commentedon Aug 12, 2021
Given our recent switch to pybind11 (which gets completed with #814), I actually think this issue is mostly obsolete. @sloretz what do you think? Should we just close this one out?
sloretz commentedon Aug 12, 2021
Yup, this one can be closed 🎉
Merge pull request ros2#139 from Carter12s/codegen-dependent-files