restrict the types that can be promoted to float
This commit is contained in:
parent
ffaaa28b37
commit
d940f3f3ae
@ -218,7 +218,9 @@ def validate_value(datatype, value):
|
|||||||
value = value.decode()
|
value = value.decode()
|
||||||
elif datatype is bytes and isinstance(value, text):
|
elif datatype is bytes and isinstance(value, text):
|
||||||
value = value.encode()
|
value = value.encode()
|
||||||
elif datatype is float and not isinstance(value, float):
|
elif datatype is float and (isinstance(value, int)
|
||||||
|
or isinstance(value, text)
|
||||||
|
or isinstance(value, bytes)):
|
||||||
value = float(value)
|
value = float(value)
|
||||||
elif not isinstance(value, datatype):
|
elif not isinstance(value, datatype):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user