danielgtaylor / danielgtaylor/python-betterproto

Gracefully handle encoding of different number types

Offen
#84 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
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

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.