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

gh-133940: test_strftime incorrectly calculates expected week#134281

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
gpshead merged 1 commit intopython:mainfromGGyll:main
May 20, 2025

Conversation

GGyll
Copy link
Contributor

@GGyllGGyll commentedMay 19, 2025
edited by bedevere-appbot
Loading

self.jan1 results to January 1st 2024 if set to Irish Time Zone. By letting time.mktime correct the tm_wday and tm_isdst values we can prevent this and we will always get the current year.

@python-cla-bot
Copy link

python-cla-botbot commentedMay 19, 2025
edited
Loading

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-appbedevere-appbot added the testsTests in the Lib/test dir labelMay 19, 2025
@bedevere-app
Copy link

Most changes to Pythonrequire a NEWS entry. Add one using theblurb_it web app or theblurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply theskip news label instead.

@GGyll
Copy link
ContributorAuthor

This is a test change so no NEWS entry needed

Comment on lines +42 to +56
jan1 = time.struct_time(
(
now.tm_year, # Year
1, # Month (January)
1, # Day (1st)
0, # Hour (0)
0, # Minute (0)
0, # Second (0)
-1, # tm_wday (will be determined)
1, # tm_yday (day 1 of the year)
-1, # tm_isdst (let the system determine)
)
)
# use mktime to get the correct tm_wday and tm_isdst values
self.jan1 = time.localtime(time.mktime(jan1))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Suggested change
jan1=time.struct_time(
(
now.tm_year,# Year
1,# Month (January)
1,# Day (1st)
0,# Hour (0)
0,# Minute (0)
0,# Second (0)
-1,# tm_wday (will be determined)
1,# tm_yday (day 1 of the year)
-1,# tm_isdst (let the system determine)
)
)
# use mktime to get the correct tm_wday and tm_isdst values
self.jan1=time.localtime(time.mktime(jan1))
self.jan1=time.localtime(time.mktime((now[0],1,1,0,0,0,-1,1,-1)))

Why not just all on one line like before, it seems clear to me, and this is a test after all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

FWIW I like the long version myself.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

IMO it is overkill and distracting, if you are looking at these tests you are probably familiar withstruct_time anyway.

Copy link
Contributor

@StanFromIrelandStanFromIreland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I can confirm it works. I changed the buildbot config so running it here will be of no use.

gpshead reacted with heart emoji
@gpshead
Copy link
Member

!buildbot raspbian

@gpsheadgpshead added the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelMay 19, 2025
@StanFromIreland
Copy link
Contributor

StanFromIreland commentedMay 19, 2025
edited
Loading

I changed the buildbot config so running it here will be of no use.

@gpshead There is no point unless you have changed the config on yours? It seems buildbot is down right now too.

@gpsheadgpshead added needs backport to 3.13bugs and security fixes needs backport to 3.14bugs and security fixes labelsMay 20, 2025
@gpsheadgpshead merged commite3dda8f intopython:mainMay 20, 2025
56 checks passed
@miss-islington-app
Copy link

Thanks@GGyll for the PR, and@gpshead for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 20, 2025
…ythonGH-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>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestMay 20, 2025
…ythonGH-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>
@bedevere-app
Copy link

GH-134301 is a backport of this pull request to the3.14 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.14bugs and security fixes labelMay 20, 2025
@bedevere-app
Copy link

GH-134302 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelMay 20, 2025
gpshead pushed a commit that referenced this pull requestMay 20, 2025
…H-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>
gpshead pushed a commit that referenced this pull requestMay 20, 2025
…H-134281) (#134301)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>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@gpsheadgpsheadgpshead approved these changes

@StanFromIrelandStanFromIrelandStanFromIreland left review comments

@pgansslepganssleAwaiting requested review from pgansslepganssle is a code owner

@abalkinabalkinAwaiting requested review from abalkinabalkin is a code owner

Assignees

@gpsheadgpshead

Labels
🔨 test-with-buildbotsTest PR w/ buildbots; report in status sectionskip newssprinttestsTests in the Lib/test dir
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@GGyll@gpshead@StanFromIreland

[8]ページ先頭

©2009-2025 Movatter.jp