Skip to content

Commit

Permalink
Fini arguments passed to rcl_node_init() (#187)
Browse files Browse the repository at this point in the history
  • Loading branch information
sloretz authored May 1, 2018
1 parent 3735963 commit e9c34b5
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions rclpy/src/rclpy/_rclpy.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,27 @@ rclpy_create_node(PyObject * Py_UNUSED(self), PyObject * args)
}
rcl_reset_error();
PyMem_Free(node);

if (RCL_RET_OK != rcl_arguments_fini(&arguments)) {
rcl_reset_error();
// Warn because an exception is already raised
// Warning should use line number of the current stack frame
int stack_level = 1;
PyErr_WarnFormat(
PyExc_RuntimeWarning, stack_level, "Failed to fini arguments during error handling: %s",
rcl_get_error_string_safe());
}
return NULL;
}
if (RCL_RET_OK != rcl_arguments_fini(&arguments)) {
rcl_reset_error();
// Warn because the node was successfully created
// Warning should use line number of the current stack frame
int stack_level = 1;
PyErr_WarnFormat(
PyExc_RuntimeWarning, stack_level, "Failed to fini arguments: %s",
rcl_get_error_string_safe());
}
return PyCapsule_New(node, "rcl_node_t", NULL);
}

Expand Down

0 comments on commit e9c34b5

Please sign in to comment.