diff --git a/CHANGELOG.rst b/CHANGELOG.rst index abe24f4..fbc85fa 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,11 @@ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Changelog for package genmsg ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +0.5.11 (2018-05-01) +------------------- +* use ast.literal_eval instead of eval (`#73 `_) +* fix undefined name in case of exception (`#75 `_) 0.5.10 (2018-01-25) ------------------- diff --git a/package.xml b/package.xml index 471c7d8..d33ffe6 100644 --- a/package.xml +++ b/package.xml @@ -1,7 +1,7 @@ genmsg - 0.5.10 + 0.5.11 Standalone Python library for generating ROS message and service data structures for various languages. diff --git a/src/genmsg/msg_loader.py b/src/genmsg/msg_loader.py index bb9351a..7425fbf 100644 --- a/src/genmsg/msg_loader.py +++ b/src/genmsg/msg_loader.py @@ -39,6 +39,7 @@ possible layouts. """ +import ast import os import sys @@ -181,8 +182,7 @@ raise InvalidMsgSpec("cannot coerce [%s] to %s (out of bounds)"%(val, field_type)) return val elif field_type == 'bool': - # TODO: need to nail down constant spec for bool - return True if eval(val) else False + return True if ast.literal_eval(val) else False raise InvalidMsgSpec("invalid constant type: [%s]"%field_type) def _load_constant_line(orig_line): @@ -203,7 +203,7 @@ else: line_splits = [x.strip() for x in ' '.join(line_splits[1:]).split(CONSTCHAR)] #resplit on '=' if len(line_splits) != 2: - raise InvalidMsgSpec("Invalid constant declaration: %s"%l) + raise InvalidMsgSpec("Invalid constant declaration: %s"%orig_line) name = line_splits[0] val = line_splits[1]