danielgtaylor / danielgtaylor/python-betterproto

Gracefully handle encoding of different number types

Aperta
#84 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
bug good first issue high priority small
Lingua principale
Python
Stelle
1.8k
Fork
234
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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'
```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.