Skip to content

gh-131146: Fix month names in a genitive case in calendar module #131147

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

Merged
merged 19 commits into from
Jul 31, 2025

Conversation

plashchynski
Copy link
Contributor

@plashchynski plashchynski commented Mar 12, 2025

The calendar module displays month names in some locales using the genitive case. This is grammatically incorrect, as the nominative case should be used when the month is named by itself. To address this issue, this change introduces new lists alt_month_name and alt_month_abbr that contain month names in the nominative case. The module now uses %OB format specifier to get month names in the nominative case where available.

The calendar module displays month names in some locales using the genitive case.
This is grammatically incorrect, as the nominative case should be used when the month
is named by itself. To address this issue, this change introduces new lists
`alt_month_name` and `alt_month_abbr` that contain month names in the nominative case.
The module now uses `%OB` format specifier to get month names in the nominative case
where available.
@ghost
Copy link

ghost commented Mar 12, 2025

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app
Copy link

bedevere-app bot commented Mar 12, 2025

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

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

Copy link
Member

@tomasr8 tomasr8 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! This will also need a NEWS entry and tests (check Lib/test/test_calendar.py)

@StanFromIreland
Copy link
Member

I can finish this off if you are unable to, it should still be backported to 3.14 since it is a bug fix, no?

@StanFromIreland

This comment was marked as resolved.

@plashchynski
Copy link
Contributor Author

This also needs a proper test (my comment was incorrectly closed) using support's @run_with_locale, grep the existing tests for usage examples, there are quite a few.

The problem is specific only to certain locales. To properly test it, we need to have these locales installed. A test with @run_with_locale will fail only on systems where that locales are installed. So for most systems that test will be green without proposed changes. I think it's not worth to add tests that can't fail on most of the systems.

@StanFromIreland
Copy link
Member

So for most systems that test will be green without proposed changes.

It will not pass, it will be skipped.

I think it's not worth to add tests that can't fail on most of the systems.

It is! Most systems have locale like pl_PL installed anyway, looking at the buildbots the majority do.

@plashchynski
Copy link
Contributor Author

plashchynski commented May 11, 2025

I think it's not worth to add tests that can't fail on most of the systems.

It is! Most systems have locale like pl_PL installed anyway, looking at the buildbots the majority do.

Even if the system has pl_PL installed, it's possible that it doesn't support %OB %Ob extensions. And we don't know for sure weather it supported or not.

Given this, how could we distinguish the wrong behaviour from the fallback route?
I mean, if we test for the standalone form, it's possible that the regular form is returned because of the fallback.
Hope it makes sense.

@encukou
Copy link
Member

encukou commented May 19, 2025

One trick would be to check for some common platform that does support %OB, for example:

if platform.libc_ver()[0] == 'glibc':
    "Polish month 2 MUST be 'luty'"
else:
    "Polish month 2 could be either 'luty' or 'lut'"

@serhiy-storchaka
Copy link
Member

The test should check for example that calendar.standalone_month_name[5] is contained in the calendar output for May. It can also skip if calendar.standalone_month_name[5] == calendar.month_name[5].

@plashchynski
Copy link
Contributor Author

I've added a new test test_standalone_month_name_and_abbr_pl_locale to verify the standalone month names and abbrs specifically in pl_PL. Please check.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM. 👍

@encukou encukou merged commit 438cbd8 into python:main Jul 31, 2025
45 checks passed
@encukou
Copy link
Member

encukou commented Jul 31, 2025

Thank you for seeing this through, @plashchynski!

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

Successfully merging this pull request may close these issues.

9 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy