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 conversion from C to Python in case a sequence has default values #55

Merged
merged 1 commit into from
May 8, 2019

Conversation

dirk-thomas
Copy link
Member

Since we currently don't have a way to construct a Python message class without its default values we have to remove them before populating the array.array fields using frombytes.

Related to ros2/test_interface_files#5.

@dirk-thomas dirk-thomas added bug Something isn't working in review Waiting for review (Kanban column) labels May 8, 2019
@dirk-thomas dirk-thomas self-assigned this May 8, 2019
@dirk-thomas
Copy link
Member Author

Passed CI, see ros2/test_interface_files#5 (comment)

Signed-off-by: Dirk Thomas <dirk-thomas@users.noreply.github.com>
@dirk-thomas dirk-thomas force-pushed the dirk-thomas/sequences-with-default_values branch from 4af73ab to b8727ec Compare May 8, 2019 22:52
Py_DECREF(field);
return NULL;
}
// clear the array, poor approach to remove potential default values
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also create a new array object with the same typecode. But I'm not sure if this would be any prettier, or if we still need to worry about decref'ing the individual elements.

In any case, this looks okay to me with green CI.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be happy to do so but couldn't figure out how to instantiate an array.array from the C code when I wrote this originally 😞

@dirk-thomas dirk-thomas merged commit b678934 into master May 8, 2019
@delete-merged-branch delete-merged-branch bot deleted the dirk-thomas/sequences-with-default_values branch May 8, 2019 23:00
@dirk-thomas dirk-thomas removed the in review Waiting for review (Kanban column) label May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants