Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Chris Lalancette <[email protected]>
  • Loading branch information
ksuszka and clalancette authored Apr 30, 2021
1 parent 841dfdb commit 0f1d815
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions rosidl_generator_py/resource/_msg_support.c.em
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ nested_type = '__'.join(type_.namespaced_name())
// Optimization for converting arrays of primitives
Py_buffer view;
int rc = PyObject_GetBuffer(field, &view, PyBUF_SIMPLE);
if (rc) {
if (rc < 0) {
PyErr_SetString(PyExc_RuntimeError, "unable to get buffer");
Py_DECREF(field);
return false;
Expand All @@ -267,7 +267,7 @@ nested_type = '__'.join(type_.namespaced_name())
}
@primitive_msg_type_to_c(member.type.value_type) * dest = ros_message->@(member.name).data;
rc = PyBuffer_ToContiguous(dest, &view, view.len, 'C');
if (rc) {
if (rc < 0) {
PyErr_SetString(PyExc_RuntimeError, "unable to copy buffer");
PyBuffer_Release(&view);
Py_DECREF(field);
Expand Down

0 comments on commit 0f1d815

Please sign in to comment.