Git Product home page Git Product logo

Comments (9)

pr-db avatar pr-db commented on July 24, 2024 2

@sloretz Hello, I'm new to open source and love working with ros. How can I approach this issue?

from rclpy.

suab321321 avatar suab321321 commented on July 24, 2024 1

I would like to help with this one @sloretz should I proceed?

from rclpy.

darrylbalderas avatar darrylbalderas commented on July 24, 2024

First time contributing to open source and interested in learning more about how to fix this issue.

from rclpy.

sloretz avatar sloretz commented on July 24, 2024

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 return NULL right away.

rclpy/rclpy/src/rclpy/_rclpy.c

Lines 1550 to 1552 in 62012d3

if (!PyArg_ParseTuple(args, "OOOO", &pynode, &pymsg_type, &pytopic, &pyqos_profile)) {
return NULL;
}

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.

rclpy/rclpy/src/rclpy/_rclpy.c

Lines 1693 to 1697 in 62012d3

PyObject * pylist = PyList_New(2);
PyList_SET_ITEM(pylist, 0, PyCapsule_New(client, "rcl_client_t", NULL));
PyList_SET_ITEM(pylist, 1, PyLong_FromUnsignedLongLong((uint64_t)&client->impl));
return pylist;

A good first PR would fix one instance of a function that can fail not being checked.

from rclpy.

darrylbalderas avatar darrylbalderas commented on July 24, 2024

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

from rclpy.

darrylbalderas avatar darrylbalderas commented on July 24, 2024

@sloretz
Do you want me to switch this null error checking

rclpy/rclpy/src/rclpy/_rclpy.c

Lines 3642 to 3645 in 62012d3

value = PyList_New(variant->string_array_value->size);
if (NULL == value) {
return NULL;
}

to this implementation instead

rclpy/rclpy/src/rclpy/_rclpy.c

Lines 1550 to 1552 in 62012d3

if (!PyArg_ParseTuple(args, "OOOO", &pynode, &pymsg_type, &pytopic, &pyqos_profile)) {
return NULL;
}

from rclpy.

sloretz avatar sloretz commented on July 24, 2024

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

from rclpy.

clalancette avatar clalancette commented on July 24, 2024

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?

from rclpy.

sloretz avatar sloretz commented on July 24, 2024

Yup, this one can be closed 🎉

from rclpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.