Skip to content

Commit

Permalink
fix: correct argument validation and formatting
Browse files Browse the repository at this point in the history
Remove unnecessary whitespace and enhance error handling for argument types in the publishing function, ensuring clear type checking and preventing potential runtime errors.
  • Loading branch information
zhangyi committed Nov 11, 2024
1 parent 78a4425 commit 91e107f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion src/runtime/python_runtime/aimrt_py_chn.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ def Publish(publisher: aimrt_python_runtime.PublisherRef, second, third=None):
else:
raise TypeError("Invalid arguments, no protobuf message or ROS2 message found")


if not isinstance(ctx_or_type, (aimrt_python_runtime.Context, aimrt_python_runtime.ContextRef, str)) and \
ctx_or_type is not None:
raise TypeError(
Expand Down
2 changes: 1 addition & 1 deletion src/runtime/python_runtime/ros2_type_support_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,4 @@ inline py::object convert_to_py(void* message, py::object pyclass) {

// End of adapted code from ros2 rclpy.

} // namespace aimrt::runtime::python_runtime
} // namespace aimrt::runtime::python_runtime

0 comments on commit 91e107f

Please sign in to comment.