FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix TypeError in tzstr for GMT/UTC without an offset by prownd · Pull Request #1563 · dateutil/dateutil · GitHub

Fix TypeError in tzstr for GMT/UTC without an offset - #1563

Open
prownd wants to merge 1 commit into
dateutil:masterfrom
prownd:fix-TypeError-in-tzstr-for-GMT-UTC-without-an-offset-s01
Open

prownd wants to merge 1 commit into
dateutil:masterfrom
prownd:fix-TypeError-in-tzstr-for-GMT-UTC-without-an-offset-s01

Conversation

prownd commented Sep 7, 2026

Copy link
Copy Markdown

tzstr inverts the sign of the standard offset for GMT and UTC, but did so unconditionally, while _parsetz leaves stdoffset as None when the string carries no offset. tzstr("GMT"), tzstr("UTC") and gettz("GMT,4;3/4") died with "unsupported operand type(s) for *=: 'NoneType' and 'int'".

Only invert an offset that is actually there; offset-less GMT and UTC now fall through to tzrange's zero-offset default, as tzstr("EST") already did.

Fixes GH #1432.
Fixes GH #1402.

Summary of changes

Closes

Pull Request Checklist

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

tzstr inverts the sign of the standard offset for GMT and UTC, but did so
unconditionally, while _parsetz leaves stdoffset as None when the string
carries no offset. tzstr("GMT"), tzstr("UTC") and gettz("GMT,4;3/4") died
with "unsupported operand type(s) for *=: 'NoneType' and 'int'".

Only invert an offset that is actually there; offset-less GMT and UTC now
fall through to tzrange's zero-offset default, as tzstr("EST") already did.

Fixes GH dateutil#1432.
Fixes GH dateutil#1402.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL