pydantic / speedate

Fast and simple datetime, date, time and duration parsing for rust.
https://docs.rs/speedate/latest/speedate/
MIT License
199 stars 17 forks source link

Fix overflow issue in `hour` check for timedelta #70

Closed sydney-runkle closed 3 months ago

davidhewitt commented 3 months ago

I think that line got copied from another point in the code, so might be worth having a quick check if other locations are similarly problematic

sydney-runkle commented 3 months ago

See https://github.com/pydantic/pydantic-core/actions/runs/9683851266/job/26720269595?pr=1347 for the place where we discovered this error!

sydney-runkle commented 3 months ago

Seems like other occurrences are guarded by ascii checks: https://github.com/search?q=repo%3Apydantic%2Fspeedate%20-%20b%270%27&type=code

davidhewitt commented 3 months ago

Actually a last minute thought - wrapping_sub may be sufficient here and might be faster because no need to branch. Might be interesting to benchmark 😁

davidhewitt commented 3 months ago

(or it could be that the difference comes out as noise)