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

Gracefully handle encoding of different number types #84

Open
nat-n opened this issue Jun 8, 2020 · 1 comment
Open

Gracefully handle encoding of different number types #84

nat-n opened this issue Jun 8, 2020 · 1 comment
Labels
bug Something isn't working good first issue Good for newcomers high priority small Low effort issue that can easily be picked up
Projects
Milestone

Comments

@nat-n
Copy link
Collaborator

nat-n commented Jun 8, 2020

If a float is set on a Message field of type int then an exception is raised when serialising. Floats and ints are largely interchangeable in python3, so maybe betterproto should handle this more gracefully, by for example: casting to int or float as appropriate before encoding.

The resulting error message includes:

unsupported operand type(s) for &: 'float' and 'int'
@boukeversteegh
Copy link
Collaborator

@boukeversteegh boukeversteegh added this to Backlog in Betterproto via automation Jun 8, 2020
@boukeversteegh boukeversteegh added this to the Better Types milestone Jun 8, 2020
@boukeversteegh boukeversteegh added bug Something isn't working good first issue Good for newcomers small Low effort issue that can easily be picked up labels Jun 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers high priority small Low effort issue that can easily be picked up
Projects
Betterproto
  
Backlog
Development

No branches or pull requests

2 participants