convert_to_py
/home/tusimple/ros2_ws/build_isolated/std_msgs/rosidl_generator_py/std_msgs/msg _string_s.c +89
PyObject * std_msgs_string__convert_to_py(void * raw_ros_message)
{
/* NOTE(esteve): Call constructor of String */
PyObject * _pymessage = NULL;
{
PyObject * pymessage_module = PyImport_ImportModule("std_msgs.msg._string");
assert(pymessage_module);
PyObject * pymessage_class = PyObject_GetAttrString(pymessage_module, "String");
assert(pymessage_class);
Py_DECREF(pymessage_module);
_pymessage = PyObject_CallObject(pymessage_class, NULL);
Py_DECREF(pymessage_class);
if (!_pymessage) {
return NULL;
}
}
std_msgs__msg__String * ros_message = (std_msgs__msg__String )raw_ros_message;
{ // data
size_t tic,toc;
tic=current_time();
PyObject * field = NULL;
field = PyUnicode_FromString(ros_message->data.data);
{
int rc = PyObject_SetAttrString(_pymessage, "data", field);
toc=current_time();
printf("@%s diff=%lfms\n",func,(toc-tic)1.0E-6);
Py_DECREF(field);
if (rc) {
return NULL;
}
}
}
// ownership of _pymessage is transferred to the caller
return _pymessage;
}