Skip to content

Handle time-only calls for date-dependent tzical zones - #1606

Open
fhgffy wants to merge 2 commits into
dateutil:masterfrom
fhgffy:fix/tzical-time-only
Open

fhgffy wants to merge 2 commits into
dateutil:masterfrom
fhgffy:fix/tzical-time-only

Conversation

@fhgffy

@fhgffy fhgffy commented Oct 9, 2026

Copy link
Copy Markdown

Summary of changes

time.dst() and time.tzname() pass None to their timezone. A tzical zone with multiple observances currently attempts to select a component using that value and raises AttributeError. Return None when a date is required to choose the observance, while preserving the existing single-observance results. Add time-object regressions, an author entry, and a news fragment.

Validation: the dst/tzname regressions fail on the original source, while the utcoffset and fixed-observance controls already pass. After the change, 44 tzical tests pass with one platform skip. The complete Windows suite has the same four localized tzres-name failures as the unmodified base (2,002 vs 1,998 passing tests). Darker/isort/Black, whitespace/debug hooks, and sdist/wheel builds passed.

Pull Request Checklist

  • Changes have tests
  • Authors have been added to AUTHORS.md
  • News fragment added in changelog.d

Reference: https://docs.python.org/3/library/datetime.html#tzinfo-objects

@Wkhanex Wkhanex left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Time-only calls now return None for multi-observance zones, including a daylight-only pair. The single-observance name/DST behavior remains intact, and dated winter/summer offset controls still select their respective observances.

Checked d0831ddbd0f6 with standalone Python 3.12.14 checks (11 passing assertions). I haven't run the full upstream suite.

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.

2 participants