Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
corrected logics of checks for c99 support
  • Loading branch information
blhsing committed Jul 30, 2024
commit bfd2f18648bf4137b8e72505efe0d0c9ad10ed7a
4 changes: 2 additions & 2 deletions Lib/_pydatetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ def _can_support_c99():
if _supports_c99 is None:
try:
_supports_c99 = (
_time.strftime("%F", (99, 1, 1, 0, 0, 0, 0, 1, 0)) != "%F")
_time.strftime("%F", (1900, 1, 1, 0, 0, 0, 0, 1, 0)) == "1900-01-01")
except ValueError:
_supports_c99 = True
pass
Comment thread
blhsing marked this conversation as resolved.
Outdated
return _supports_c99

# Correctly substitute for %z and %Z escapes in strftime formats.
Expand Down
2 changes: 1 addition & 1 deletion Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -1711,7 +1711,7 @@ def test_strftime_y2k(self):
(1970, 0),
)
specifiers = 'YG'
if _time.strftime('%F', (99, 1, 1, 0, 0, 0, 0, 1, 0)) != '%F':
if _time.strftime('%F', (1900, 1, 1, 0, 0, 0, 0, 1, 0)) == '1900-01-01':
specifiers += 'FC'
for year, g_offset in dataset:
for specifier in specifiers:
Expand Down
10 changes: 5 additions & 5 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -6709,19 +6709,19 @@ int main(void)
{
char full_date[11];
struct tm date = {
.tm_year = -1801,
.tm_year = 0,
.tm_mon = 0,
.tm_mday = 1
};
if (strftime(full_date, sizeof(full_date), "%F", &date) && !strcmp(full_date, "%F")) {
return 1;
if (strftime(full_date, sizeof(full_date), "%F", &date) && !strcmp(full_date, "1900-01-01")) {
return 0;
}
return 0;
return 1;
}
]])],
[ac_cv_strftime_c99_support=yes],
[ac_cv_strftime_c99_support=no],
[ac_cv_strftime_c99_support=yes])])
[ac_cv_strftime_c99_support=no])])
if test "$ac_cv_strftime_c99_support" = yes
then
AC_DEFINE([Py_STRFTIME_C99_SUPPORT], [1],
Expand Down