Repository navigation
Fix negative subsecond timestamp parsing - #1387
Conversation
Codecov Reportβ
All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1387 +/- ##
=======================================
Coverage 97.20% 97.21%
=======================================
Files 236 236
Lines 3081 3083 +2
=======================================
+ Hits 2995 2997 +2
Misses 86 86 β View full report in Codecov by Harness. π New features to boost your workflow:
|
|
Merged current master in 2db57e7 and resolved the test conflict by preserving both the timestamp regressions and upstream type annotations. Validation: The new workflows are waiting for approval; could a maintainer approve the CI runs? |
serhii73
left a comment
There was a problem hiding this comment.
Reviewed the diff. Negative sub-second timestamps are now floored correctly via divmod, so -1015673450000001 gives 12:29:09.999999 instead of 12:29:10.000001. The updated expectation is right, and the new tests cover the boundaries. Full suite passes on this branch merged with current master (24793 passed).
Negative millisecond and microsecond timestamps apply the fractional digits with a positive sign. For example,
-1570308760263111parses as1920-03-29 03:07:20.263111in UTC instead of1920-03-29 03:07:19.736889.Normalize negative timestamps into whole seconds and a nonnegative microsecond remainder before converting the timezone. The calculation uses integers to preserve microsecond precision. Add seven parser regressions covering milliseconds, microseconds, zero fractions, and the microsecond boundaries.
Validation after syncing with current master:
TZ=UTC tox -e allon Python 3.14.7, with calendar and language detection extras: 24,627 passed, 4 skipped, 1 expected failure.tox -e mypy: no issues in 285 source files (Python 3.10).tox -e pre-commit: Ruff lint/format and zizmor passed.git diff --checkpassed.The initial local run in America/New_York hit two unchanged upstream clean-API tests that assume the default timezone differs from EST. The full suite passes with
TZ=UTC, matching the CI configuration.