-
-
Notifications
You must be signed in to change notification settings - Fork 31.2k
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-37552 strptime/strftime return invalid results with UCRT version 17763.615 #14460
Changes from 7 commits
2e8cc0a
a805590
6cfcddb
323f283
ce72404
7665b54
ccde057
e8001cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
import glob | ||
import importlib | ||
import importlib.util | ||
import locale | ||
import logging.handlers | ||
import nntplib | ||
import os | ||
|
@@ -92,7 +93,7 @@ | |
"bigmemtest", "bigaddrspacetest", "cpython_only", "get_attribute", | ||
"requires_IEEE_754", "skip_unless_xattr", "requires_zlib", | ||
"anticipate_failure", "load_package_tests", "detect_api_mismatch", | ||
"check__all__", "skip_unless_bind_unix_socket", | ||
"check__all__", "skip_unless_bind_unix_socket", "skip_if_buggy_ucrt", | ||
"ignore_warnings", | ||
# sys | ||
"is_jython", "is_android", "check_impl_detail", "unix_shell", | ||
|
@@ -2501,6 +2502,27 @@ def skip_unless_symlink(test): | |
msg = "Requires functional symlink implementation" | ||
return test if ok else unittest.skip(msg)(test) | ||
|
||
_buggy_ucrt = None | ||
def skip_if_buggy_ucrt(test): | ||
""" | ||
Skip decorator for tests that use buggy strptime/strftime | ||
|
||
If the UCRT bugs are present time.localtime().tm_zone will be | ||
an empty string, otherwise we assume the UCRT bugs are fixed | ||
|
||
See bpo-37552 [Windows] strptime/strftime return invalid | ||
results with UCRT version 17763.615 | ||
""" | ||
global _buggy_ucrt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not a particularly expensive check, right? Why cache it instead of checking each time? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The caching is simple and easy to follow; I'd rather keep it than assume it's not worthwhile :) |
||
if _buggy_ucrt is None: | ||
if(sys.platform == 'win32' and | ||
locale.getdefaultlocale()[1] == 'cp65001' and | ||
time.localtime().tm_zone == ''): | ||
_buggy_ucrt = True | ||
else: | ||
_buggy_ucrt = False | ||
return unittest.skip("buggy MSVC UCRT")(test) if _buggy_ucrt else test | ||
|
||
class PythonSymlink: | ||
"""Creates a symlink for the current Python executable""" | ||
def __init__(self, link=None): | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this now lives in
test.support
, it might be worthwhile to mention 'time' in the name (skip_if_buggy_ucrt_strfptime
or similar).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added strftime/strptime to the skip message and skip decorator name