Skip to content

Commit

Permalink
Add doc-string warnings for destroy() methods (#1204)
Browse files Browse the repository at this point in the history
* publisher.py: add doc-string warning for destroy method

Signed-off-by: Steve Peters <[email protected]>

* subscription.py: add doc-string warning for destroy method

Signed-off-by: Steve Peters <[email protected]>

---------

Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters authored Dec 6, 2023
1 parent e97c41b commit f57efa5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions rclpy/rclpy/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ def handle(self):
return self.__publisher

def destroy(self):
"""
Destroy a container for a ROS publisher.
.. warning:: Users should not destroy a publisher with this method, instead they should
call :meth:`.Node.destroy_publisher`.
"""
for handler in self.event_handlers:
handler.destroy()
self.__publisher.destroy_when_not_in_use()
Expand Down
6 changes: 6 additions & 0 deletions rclpy/rclpy/subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ def handle(self):
return self.__subscription

def destroy(self):
"""
Destroy a container for a ROS subscription.
.. warning:: Users should not destroy a subscription with this method, instead they
should call :meth:`.Node.destroy_subscription`.
"""
for handler in self.event_handlers:
handler.destroy()
self.handle.destroy_when_not_in_use()
Expand Down

0 comments on commit f57efa5

Please sign in to comment.