Fix issue #1679: Add deprecation of interface variables#251
Draft
Pengkun-ZHU wants to merge 1 commit intoros2:kiltedfrom
Draft
Fix issue #1679: Add deprecation of interface variables#251Pengkun-ZHU wants to merge 1 commit intoros2:kiltedfrom
Pengkun-ZHU wants to merge 1 commit intoros2:kiltedfrom
Conversation
Signed-off-by: Pengkun-ZHU <q1091803103@gmail.com>
624a621 to
a30b504
Compare
Contributor
|
I can write my own implementation or you can update yours. Either is fine but you would have to add the deprecation push pop probably to the message.c.em. You should also use deprecation from typing_extensions. And finally use the text from the annotation some where in the message so user can know what to migrate to |
Author
|
Sure, I will make a further change to align with your implementation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion to ros2/rosidl#946 (fixes ros2/ros2#1679)
Summary
Adds
DeprecationWarningsupport to the Python message generator for fields annotated with@deprecated.What this changes
rosidl_generator_py/resource/_msg.py.emFor any field whose IDL
Membercarries a@deprecatedannotation (set via# @deprecatedin the.msgsource), the generated Python property getter and setter now emit:This fires at runtime whenever user code reads or writes the deprecated field, following standard Python deprecation convention (
stacklevel=2points the warning at the caller, not the generated code).Coverage
The
_msg.py.emtemplate is the single leaf template invoked for all message-like types — messages, service request/response/event sub-messages, and action goal/result/feedback sub-messages — so the warning propagates automatically to.srvand.actionfields as well.Known limitations / out of scope
# @deprecatedcarries no free-text argument in this version.@deprecateddoes not affect type hash or serialization.