Skip to content

bpo-45239: Fix parsedate_tz when time has more than 2 dots in it #28452

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 13, 2021

Conversation

benhoyt
Copy link
Contributor

@benhoyt benhoyt commented Sep 18, 2021

Fixes issue 45239: https://bugs.python.org/issue45239

More details in the issue, but here's the repro case:

$ python3.10 -c 'import email.utils; \
    email.utils.parsedate_tz("Wed, 3 Apr 2002 12.34.56.78+0800")'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/local/lib/python3.10/email/_parseaddr.py", line 50, in parsedate_tz
    res = _parsedate_tz(data)
  File "/usr/local/lib/python3.10/email/_parseaddr.py", line 134, in _parsedate_tz
    thh = int(thh)
UnboundLocalError: local variable 'thh' referenced before assignment

https://bugs.python.org/issue45239

@ambv ambv merged commit b9e6876 into python:main Oct 13, 2021
@miss-islington
Copy link
Contributor

Thanks @benhoyt for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry @benhoyt and @ambv, I had trouble checking out the 3.10 backport branch.
Please backport using cherry_picker on command line.
cherry_picker b9e687618d3489944f29adbd2be50b46940c9e70 3.10

@bedevere-bot
Copy link

GH-28928 is a backport of this pull request to the 3.9 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Oct 13, 2021
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Oct 13, 2021
…honGH-28452)

Co-authored-by: Łukasz Langa <[email protected]>
(cherry picked from commit b9e6876)

Co-authored-by: Ben Hoyt <[email protected]>
ambv pushed a commit to ambv/cpython that referenced this pull request Oct 13, 2021
…it (pythonGH-28452)

Co-authored-by: Łukasz Langa <[email protected]>
(cherry picked from commit b9e6876)

Co-authored-by: Ben Hoyt <[email protected]>
@bedevere-bot
Copy link

GH-28930 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Oct 13, 2021
ambv pushed a commit that referenced this pull request Oct 13, 2021
…28452) (GH-28928)

Co-authored-by: Łukasz Langa <[email protected]>
(cherry picked from commit b9e6876)

Co-authored-by: Ben Hoyt <[email protected]>
ambv added a commit that referenced this pull request Oct 13, 2021
…it (GH-28452) (GH-28930)

Co-authored-by: Łukasz Langa <[email protected]>
(cherry picked from commit b9e6876)

Co-authored-by: Ben Hoyt <[email protected]>
@benhoyt benhoyt deleted the bpo-45239 branch November 1, 2021 06:54
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.

5 participants