Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit783675e

Browse files
[3.13]gh-133940: test_strftime incorrectly calculates expected week (GH-134281) (#134302)
gh-133940: test_strftime incorrectly calculates expected week (GH-134281)Let the system determine the correct tm_wday and tm_isdst.(cherry picked from commite3dda8f)Co-authored-by: Gustaf <79180496+GGyll@users.noreply.github.com>
1 parentedbde92 commit783675e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

‎Lib/test/test_strftime.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,21 @@ def _update_variables(self, now):
3939
ifnow[3]<12:self.ampm='(AM|am)'
4040
else:self.ampm='(PM|pm)'
4141

42-
self.jan1=time.localtime(time.mktime((now[0],1,1,0,0,0,0,1,0)))
42+
jan1=time.struct_time(
43+
(
44+
now.tm_year,# Year
45+
1,# Month (January)
46+
1,# Day (1st)
47+
0,# Hour (0)
48+
0,# Minute (0)
49+
0,# Second (0)
50+
-1,# tm_wday (will be determined)
51+
1,# tm_yday (day 1 of the year)
52+
-1,# tm_isdst (let the system determine)
53+
)
54+
)
55+
# use mktime to get the correct tm_wday and tm_isdst values
56+
self.jan1=time.localtime(time.mktime(jan1))
4357

4458
try:
4559
ifnow[8]:self.tz=time.tzname[1]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp