Skip to content

Fix Time data sharing mutations and missing since guard#115

Open
arpitjain099 wants to merge 1 commit into
NOAA-ORR-ERD:mainfrom
arpitjain099:chore/fix-time-mutation-110
Open

Fix Time data sharing mutations and missing since guard#115
arpitjain099 wants to merge 1 commit into
NOAA-ORR-ERD:mainfrom
arpitjain099:chore/fix-time-mutation-110

Conversation

@arpitjain099

Copy link
Copy Markdown

Fixes #110.\n\nTime now copies incoming arrays (including Time->Time) so tz/origin/displacement shifts stay local to each instance.\nconstant_time() now returns an isolated copy so one caller cannot mutate all constant-time users.\nparse_time_offset() now handles units without "since" by warning and falling back to the default offset path.\n\nAdded regression tests for input-array mutation, Time-from-Time sharing, constant_time isolation, and parse_time_offset("days") fallback behavior.\n\nVerification:\n- python3 -m pytest gridded/tests/test_time_issue_110.py\n- python3 -m pytest gridded/tests/test_time.py -k "new_tz_offset or constant_time or parse_time_offset"\n- python3 -m ruff check gridded/time.py gridded/tests/test_time_issue_110.py

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Time shifts caller-owned arrays in place and constant_time() singleton is corruptible; parse_time_offset raises bare IndexError on units without "since"

1 participant