A scanner with a dead sensor reports "dwell_time": "nan", and the ingestion endpoint answers 500. A TimeDelta field raises a plain ValueError for NaN instead of a validation error, so the request never reaches our error…
A scanner with a dead sensor reports "dwell_time": "nan", and the ingestion endpoint answers 500. A TimeDelta field raises a plain ValueError for NaN instead of a validation error, so the request never reaches our error handling.
from marshmallow import fields
fields.TimeDelta().deserialize("nan")
fields.TimeDelta().deserialize(float("nan"))
Both raise ValidationError: Not a valid period of time.
ValueError: cannot convert float NaN to integer
"inf" gives the validation error above.5 gives timedelta(seconds=5).Adapted from marshmallow-code/marshmallow (MIT).
Visible test command
pytest testsThe repository’s own tests. Run all tests includes them, and so does every submission.
Repository
timedelta-nan-crashes-load
Changes under src/ are evaluated.