Skip to content

Distinguish unnamed timezone file contents in equality - #1046

Open
FanWu-ai wants to merge 1 commit into
python-pendulum:masterfrom
FanWu-ai:fix-unnamed-timezone-equality-20261012
Open

FanWu-ai wants to merge 1 commit into
python-pendulum:masterfrom
FanWu-ai:fix-unnamed-timezone-equality-20261012

Conversation

@FanWu-ai

Copy link
Copy Markdown
Contributor

Pull Request Check List

  • Added tests for changed code.
  • Updated documentation for changed code.

Fix

Unnamed TZif-backed timezones all have key=None, so the current key-only equality makes distinct Paris/UTC/New York files equal and collapses them into one set/dictionary entry. This also affects the existing local-timezone fallback for copied /etc/localtime files.

Compare and hash the TZif bytes already retained for pickling when the key is absent. Independent loads of identical bytes and pickle round trips remain equal. Named/keyed timezone behavior and FixedTimezone are unchanged.

Twelve new cases cover distinct and identical files, collections, all pickle protocols, named/keyed/uncached controls, unrelated objects and copied-localtime discovery. Documentation explains the rule.

Validation

Linux/Python 3.12.14, unchanged dependencies and pinned hooks:

  • Fresh complete baseline: 1,871 passed / 3 existing skips in each pure-Python/native mode.
  • Final source and installed-wheel complete suites: 1,883 passed / 3 existing skips in each mode.
  • Exact regressions on pristine source: 4 failures / 13 controls per backend.
  • Strict mypy (228 files), all six hooks including Rust formatting/Clippy, strict MkDocs, rebuilt release wheel/sdist and strict Twine pass.
  • Artifact production-source bytes and native import provenance verified. Independent full reruns and 3,865 additional checks per backend pass across 23 zones, aliases, collection behavior, pickle protocols and copies.

Existing Windows/timezone skips, INFO-level docs anchor notices and Cargo metadata warning are unchanged. Other Python/OS combinations and hosted CI are not claimed passed. Prepared and tested with AI assistance (OpenAI Codex); no human review is claimed.

Compare and hash retained TZif bytes for unnamed zones so distinct local timezone files no longer collapse in sets and dictionaries. Preserve named-zone behavior.

AI assistance: OpenAI Codex.
@FanWu-ai
FanWu-ai marked this pull request as ready for review October 11, 2026 22:22
@codspeed

codspeed Bot commented Oct 11, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

⚠️ 1 benchmark spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

ℹ️ 1 benchmark has no flame graph

The flamegraph could not be generated because we failed to resolve the symbols in the profiling trace. This happens when we fail to harvest information about language frames.

✅ 1 untouched benchmark


Comparing FanWu-ai:fix-unnamed-timezone-equality-20261012 (beb8f70) with master (7840d47)

Open in CodSpeed

This branch has not been deployed

No deployments
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.

1 participant