The Wayback Machine - https://web.archive.org/web/20211023141827/https://github.com/python/cpython/pull/28765
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

bpo-45386: Handle strftime's ValueError graciously #28765

Merged
merged 1 commit into from Oct 13, 2021
Merged

Conversation

@rtobar
Copy link
Contributor

@rtobar rtobar commented Oct 6, 2021

At import time, the xmlrpc.client module uses different date formats to
test strftime so it can format years with 4 digits consistently.
Depending on the underlying C library and its strftime implementation
some of these calls can result in ValueErrors, blocking the
xmlrpc.client module from being imported.

This commit changes the behavior of this bit of code to react to
ValueError exceptions, treating the format that caused them as an
non-viable option.

https://bugs.python.org/issue45386

At import time, the xmlrpc.client module uses different date formats to
test strftime so it can format years with 4 digits consistently.
Depending on the underlying C library and its strftime implementation
some of these calls can result in ValueErrors, blocking the
xmlrpc.client module from being imported.

This commit changes the behavior of this bit of code to react to
ValueError exceptions, treating the format that caused them as an
non-viable option.
Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

LGTM!

@ambv ambv merged commit 1c83135 into python:main Oct 13, 2021
12 checks passed
@miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Oct 13, 2021

Thanks @rtobar for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9, 3.10.
🐍🍒🤖 I'm not a witch! I'm not a witch!

miss-islington added a commit to miss-islington/cpython that referenced this issue Oct 13, 2021
…ythonGH-28765)

At import time, the xmlrpc.client module uses different date formats to
test strftime so it can format years with 4 digits consistently.
Depending on the underlying C library and its strftime implementation
some of these calls can result in ValueErrors, blocking the
xmlrpc.client module from being imported.

This commit changes the behavior of this bit of code to react to
ValueError exceptions, treating the format that caused them as an
non-viable option.
(cherry picked from commit 1c83135)

Co-authored-by: rtobar <[email protected]>
miss-islington added a commit to miss-islington/cpython that referenced this issue Oct 13, 2021
…ythonGH-28765)

At import time, the xmlrpc.client module uses different date formats to
test strftime so it can format years with 4 digits consistently.
Depending on the underlying C library and its strftime implementation
some of these calls can result in ValueErrors, blocking the
xmlrpc.client module from being imported.

This commit changes the behavior of this bit of code to react to
ValueError exceptions, treating the format that caused them as an
non-viable option.
(cherry picked from commit 1c83135)

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

@bedevere-bot bedevere-bot commented Oct 13, 2021

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

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Oct 13, 2021

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

ambv pushed a commit that referenced this issue Oct 13, 2021
…H-28765) (GH-28934)

At import time, the xmlrpc.client module uses different date formats to
test strftime so it can format years with 4 digits consistently.
Depending on the underlying C library and its strftime implementation
some of these calls can result in ValueErrors, blocking the
xmlrpc.client module from being imported.

This commit changes the behavior of this bit of code to react to
ValueError exceptions, treating the format that caused them as an
non-viable option.
(cherry picked from commit 1c83135)

Co-authored-by: rtobar <[email protected]>
ambv pushed a commit that referenced this issue Oct 13, 2021
…H-28765) (GH-28935)

At import time, the xmlrpc.client module uses different date formats to
test strftime so it can format years with 4 digits consistently.
Depending on the underlying C library and its strftime implementation
some of these calls can result in ValueErrors, blocking the
xmlrpc.client module from being imported.

This commit changes the behavior of this bit of code to react to
ValueError exceptions, treating the format that caused them as an
non-viable option.
(cherry picked from commit 1c83135)

Co-authored-by: rtobar <[email protected]>
@rtobar rtobar deleted the fix-issue-45386 branch Oct 13, 2021
methane added a commit to methane/cpython that referenced this issue Oct 20, 2021
…ythonGH-28765)

At import time, the xmlrpc.client module uses different date formats to
test strftime so it can format years with 4 digits consistently.
Depending on the underlying C library and its strftime implementation
some of these calls can result in ValueErrors, blocking the
xmlrpc.client module from being imported.

This commit changes the behavior of this bit of code to react to
ValueError exceptions, treating the format that caused them as an
non-viable option.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants