Skip to content

bpo-17659: Add locale.getfirstweekday #18142

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

Open
wants to merge 35 commits into
base: main
Choose a base branch
from

Conversation

cedk
Copy link
Contributor

@cedk cedk commented Jan 23, 2020

This allows to determine the starting day of week depending on the OS
locale.

Co-authored-by: Kyle McMartin kyle@mcmartin.ca

https://bugs.python.org/issue17659

@csabella
Copy link
Contributor

Since you based your patch on the original patch, please give credit to the original author.

@cedk cedk force-pushed the locale-first-weekday branch from 90e4df6 to f31e4d5 Compare January 26, 2020 09:41
@cedk cedk requested a review from Yhg1s January 27, 2020 12:27
cedk and others added 7 commits March 29, 2020 00:20
@cedk cedk force-pushed the locale-first-weekday branch from e98a14f to c5227db Compare March 28, 2020 23:21
@merwok
Copy link
Member

merwok commented Apr 27, 2021

@tirkarthi would you like to do a final review here?

I wonder if we should add the buildbot label to make sure this compiles and works everywhere (the test also needs fr_FR locale, which may be installed on no buildbot).

@tirkarthi
Copy link
Member

My point was around a general question on the assertion. Other than that I have less knowledge to review the PR. Feel free to skip my review.

@akulakov
Copy link
Contributor

akulakov commented Nov 4, 2021

I think it's better to return None value if it could not be determined, - then user can choose which value to fall back to.

@cedk
Copy link
Contributor Author

cedk commented Nov 5, 2021

I think it's better to return None value if it could not be determined, - then user can choose which value to fall back to.

Indeed it is more flexible. So I made the change.

@bedevere-bot
Copy link

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

And if you don't make the requested changes, you will be poked with soft cushions!

@cedk cedk requested a review from tiran December 9, 2021 15:17
/* Magic constant is defined by glibc as the third value of the week
* keyword of LC_TIME */
switch (week_1stday) {
default:
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't default map to None?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed it seems that some version of glibc under en_US does not return one of the two values.

elif platform.system() == 'Windows':
self.assertEqual(locale.getfirstweekday(), 6)
else:
self.assertEqual(locale.getfirstweekday(), None)
Copy link
Member

Choose a reason for hiding this comment

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

Have you verified that the test passes on musl libc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not have access to such system.

@tiran tiran added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 9, 2021
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @tiran for commit eb6629d 🤖

If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 9, 2021
@python-cla-bot
Copy link

python-cla-bot bot commented Apr 18, 2025

All commit authors signed the Contributor License Agreement.

CLA signed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants