Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix echo of numpy.number values #37

Merged
merged 1 commit into from
Apr 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions rosidl_runtime_py/rosidl_runtime_py/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,9 @@ def _convert_value(value, truncate_length=None):
# Don't truncate keys because that could result in key collisions and data loss
new_value[_convert_value(k)] = _convert_value(v, truncate_length=truncate_length)
value = new_value
elif (
not any(isinstance(value, t) for t in (bool, float, int, numpy.number))
):
elif isinstance(value, numpy.number):
value = value.item()
elif not any(isinstance(value, t) for t in (bool, float, int)):
# Assuming value is a message since it is neither a collection nor a primitive type
value = message_to_ordereddict(value, truncate_length=truncate_length)
return value