Skip to content

Preserve time zone offsets in session values - #6170

Closed
bingdongni wants to merge 1 commit into
sqlmapproject:masterfrom
bingdongni:fix/preserve-session-timezone
Closed

bingdongni wants to merge 1 commit into
sqlmapproject:masterfrom
bingdongni:fix/preserve-session-timezone

Conversation

@bingdongni

@bingdongni bingdongni commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

A timezone-aware value returned by a database driver loses its offset when a session is reloaded. For example, 2024-01-02 03:04:00+05:30 is resumed as 2024-01-02 03:04:00.

Store the observed UTC offset, DST offset, name and fold with datetime and time values. On reload the timezone is a fixed snapshot; its original transition rules are not reconstructed. Older session values remain readable, although offsets already omitted by older versions cannot be recovered.

Tests:

  • Python 3.12: 2,752 tests run, 16 skipped.
  • PyPy 2.7 on Windows: 2,744 tests run, 37 skipped, excluding test_replication. That module has six SQLite teardown errors on this platform, also reproduced on unmodified master.
  • Pyflakes and git diff --check on the changed files.

@stamparm stamparm closed this in bf8b995 Nov 3, 2026
@stamparm

stamparm commented Nov 3, 2026

Copy link
Copy Markdown
Member

Thanks for finding this. Fixed in a smaller way (bf8b995): time zone aware values are now stored as their displayed text, so the deserializer doesn't need to grow (it's the hardened replacement for pickle, which I'd rather keep minimal).

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.

2 participants