ros / ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
http://wiki.ros.org/ros_comm
752 stars 911 forks source link

Fix/Improve $(eval ...) #2269

Open rhaschke opened 2 years ago

rhaschke commented 2 years ago

Evaluation of global symbols in list comprehension context (e.g. $(eval [arg(var) for var in ['fuga', 'arg']])) was failing: AttributeError: '_DictWrapper' object has no attribute 'get'

Essentially, symbols need to be passed as the globals argument to eval() and this argument needs to inherit from dict.

Additionally, this PR improves the discarding of private symbols (starting with double underscore). Previously, any double underscores were considered offending, even those in the middle of a symbol or in literal text. These are the same changes, I have implemented for xacro.

rhaschke commented 1 year ago

Ping @jacobperron

peci1 commented 1 year ago

This would make writing list comprehension expressions in launch files much easier! Thanks for the PR.

peci1 commented 1 year ago

@mjcarroll @sloretz friendly request for review. This PR is good to go according to me.