danielgtaylor / danielgtaylor/python-betterproto
Gracefully handle encoding of different number types
Offen
bug
good first issue
high priority
small
- Vorherrschende Sprache
- Python
- Sterne
- 1.8k
- Forks
- 234
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
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'
```
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.