Skip to content
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-17659: Add locale.getfirstweekday #18142

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

Conversation

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

@csabella csabella commented Jan 26, 2020

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

@cedk cedk requested a review from Yhg1s Jan 27, 2020
Lib/test/test_locale.py Outdated Show resolved Hide resolved
cedk and others added 7 commits Mar 28, 2020
Lib/test/test_locale.py Outdated Show resolved Hide resolved
aclocal.m4 Outdated Show resolved Hide resolved
@merwok
Copy link

@merwok 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

@tirkarthi tirkarthi commented Apr 27, 2021

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

@akulakov 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
Author

@cedk 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.

configure.ac Outdated Show resolved Hide resolved
configure.ac Outdated Show resolved Hide resolved
configure.ac Outdated Show resolved Hide resolved
Modules/_localemodule.c Outdated Show resolved Hide resolved
Modules/_localemodule.c Show resolved Hide resolved
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Dec 9, 2021

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!

configure.ac Outdated Show resolved Hide resolved
@cedk cedk requested a review from tiran Dec 9, 2021
configure.ac Outdated Show resolved Hide resolved
/* Magic constant is defined by glibc as the third value of the week
* keyword of LC_TIME */
switch (week_1stday) {
default:
Copy link
Member

@tiran tiran Dec 9, 2021

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

@cedk cedk Dec 9, 2021

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

@tiran tiran Dec 9, 2021

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

@cedk cedk Dec 9, 2021

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 label Dec 9, 2021
@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Dec 9, 2021

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

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

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots label Dec 9, 2021
@cedk cedk requested a review from tiran Dec 9, 2021
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.

None yet

9 participants