Eliminate array resetting loop in _msg_support.c.em
Open
Beginner friendly
Nobody has claimed this yet.
enhancement
- Dominant language
- EmberScript
- Stars
- 26
- Forks
- 68
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 1
Description
Description
As comment in the following code suggested, there exists a part of the code that uses a less ideal way to reset the array.
This part can be improved by replacing with either
PyObject * ret = PyObject_CallMethodNoArgs(field, "clear");but this only works with Python 3.13 or higher (reference)PySequence_DelSlice(field, 0, length)that should work in any Python version
Motivation
This is discovered and suggested in a review from PR #250
Design / Implementation Considerations
No response
Additional Information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with rosidl_generator_py/resource/_msg_support.c.em at lines 589-608 and read the surrounding comment and array-handling code. Compare the available Python APIs against the project's supported Python versions, then verify that the generated message support code resets the array without the existing loop and preserves its behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- tooling
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100