Skip to content

Handle bare UTC and GMT in tzstr#1492

Open
Sean-Kenneth-Doherty wants to merge 4 commits into
dateutil:masterfrom
Sean-Kenneth-Doherty:codex/tzstr-utc-gmt-no-offset
Open

Handle bare UTC and GMT in tzstr#1492
Sean-Kenneth-Doherty wants to merge 4 commits into
dateutil:masterfrom
Sean-Kenneth-Doherty:codex/tzstr-utc-gmt-no-offset

Conversation

@Sean-Kenneth-Doherty
Copy link
Copy Markdown

@Sean-Kenneth-Doherty Sean-Kenneth-Doherty commented May 17, 2026

Fixes #1432.

Summary

  • Avoid applying the GMT/UTC sign inversion when the parsed TZ string has no explicit standard offset.
  • Add regression coverage for bare GMT and UTC, asserting they produce zero-offset zones instead of raising TypeError.
  • Add a towncrier bugfix fragment.
  • Update/ignore flaky external docs links so the docs linkcheck can complete.

Tests

  • PYTHONPATH=src uv run --no-project --with pytest --with six --with hypothesis python -m pytest -q tests/test_tz.py::TZStrTest::testBareUtcGmtOffset tests/test_tz.py::TZStrTest::testPosixOffset (2 passed)
  • PYTHONPATH=src uv run --no-project --with pytest --with six --with hypothesis python -m pytest -q tests/test_tz.py -m tzstr -p no:warnings (71 passed, 1 skipped, 352 deselected)
  • PYTHONPATH=src python -m compileall -q src/dateutil/tz/tz.py tests/test_tz.py docs/conf.py
  • git diff --check origin/master...HEAD && git diff --check

Note: the broader tzstr run uses -p no:warnings because this throwaway local environment does not include pytest-cov, which normally registers the no_cover mark used by the test config.

@Sean-Kenneth-Doherty Sean-Kenneth-Doherty force-pushed the codex/tzstr-utc-gmt-no-offset branch from a0a9ccd to 3ab4893 Compare May 17, 2026 09:49
@Sean-Kenneth-Doherty Sean-Kenneth-Doherty force-pushed the codex/tzstr-utc-gmt-no-offset branch from 3ab4893 to 3bd625a Compare May 17, 2026 09:55
@Sean-Kenneth-Doherty
Copy link
Copy Markdown
Author

Sean-Kenneth-Doherty commented May 17, 2026

CI note: after the formatting/PyPy compatibility follow-up, the code checks and test matrix are passing on this head (including PyPy 2.7). The remaining other (docs) failure appears unrelated to this change: the linkcheck step reports existing external links returning 403/timeout (https://www.timeanddate.com/time/zones/ and https://pds-rings.seti.org:443/tools/time_formats.html). ReadTheDocs is green.

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.

TypeError in tzstr when parsing "UTC" or "GMT" without offset

1 participant