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

Python subscriptions are not type safe #71

Closed
domire8 opened this issue Mar 21, 2024 · 1 comment · Fixed by #75
Closed

Python subscriptions are not type safe #71

domire8 opened this issue Mar 21, 2024 · 1 comment · Fixed by #75
Assignees

Comments

@domire8
Copy link
Member

domire8 commented Mar 21, 2024

self.__setattr__(attribute_name, reader(message))

@yrh012 found out that if you add an input of a certain state representation type (so EncodedType), and connect it to a topic that is also publishing an encoded state but of different state representation type, the attribute will be overridden with the received message. If we want to be consistent with C++, we should probably attempt a cast on the received message such that the attribute type of the subscribing component doesn't change.

Opinions? @eeberhard @bpapaspyros

@domire8 domire8 self-assigned this Mar 21, 2024
@eeberhard
Copy link
Member

Classic Python. It's true that from the users perspective, the type of the class attribute should not change if a valid input is received and decoded. For the best way to implement it, I am not sure, but it seems like a reasonable backlog issue to address whenever a contributor has some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants