Skip to content
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

Incorrect handling of Retry-After (2.7) #1934

Closed
hodbn opened this issue Aug 25, 2020 · 3 comments · Fixed by #1935
Closed

Incorrect handling of Retry-After (2.7) #1934

hodbn opened this issue Aug 25, 2020 · 3 comments · Fixed by #1935
Assignees

Comments

@hodbn
Copy link
Member

hodbn commented Aug 25, 2020

email.utils.parsedate_tz behaves differently on python2.7/3 if the input string has no timezone. On python3, the last item of the return value is 0 where on python2.7 it is None.

Since email.utils.mktime_tz assumes a None timezone to be the local timezone, the resulting date might be wrong when calculating Retry-After timeout of a value without a timezone.

To reproduce run the following test on a python2.7 machine with timezone != UTC:
test/test_retry.py::TestRetry::test_respect_retry_after_header_sleep[Mon Jun 3 11:30:12 2019-True-1812]

(Luckily, freezegun doesn't hide the issue since it freezes only the time using tz_offset but it doesn't patch the timezone.)

@sethmlarson
Copy link
Member

sethmlarson commented Aug 25, 2020

Huh, wasn't seeing Python 2.7 failures on macOS. How'd you catch this issue?

@hodbn
Copy link
Member Author

hodbn commented Aug 25, 2020

I ran it on my Linux VM which has a weird timezone set.
It seems our CI (at least actions and travis) runs on UTC.

@sethmlarson
Copy link
Member

Ahhh makes sense, glad you caught this! :)

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 a pull request may close this issue.

2 participants