gh-123681: Check NORMALIZE_CENTURY behavior at runtime; require C99 by encukou · Pull Request #136022 · python/cpython · GitHub
Skip to content

gh-123681: Check NORMALIZE_CENTURY behavior at runtime; require C99 - #136022

Merged
encukou merged 10 commits into
python:mainfrom
encukou:strftime-c99-always
Aug 19, 2025
Merged

encukou merged 10 commits into
python:mainfrom
encukou:strftime-c99-always

Conversation

@encukou

@encukou encukou commented Jun 27, 2025

Copy link
Copy Markdown
Member

This is a continuation of #128444.

CPython requires C11, so all C99 features should work.
We might need workaround if a supported platform misbehaves (hence this PR -- I want to feed the buildbots). But, IMO, any workarounds for unsupported platforms best left to the respective forks.

Serhiy's runtime check for normalize_century is left in; I don't know about the details there.

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If remove the C99 check in the C code, we should also remove _can_support_c99() in Lib/_pydatetime.py.

Look in #122272 for reasons for adding this check at first place.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should not it be decorated with cpython_only?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point! The meaning of cpython_only is not very clear.

This test might be usable for other implementations as well, so I think it's best for other implementations to skip the test if it doesn't work for them. IMO, cpython_only is best for things like bytecode details or sys.getsizeof.
But, that's just my opinion of course.

@encukou encukou added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jul 9, 2025
@bedevere-bot

Copy link
Copy Markdown

🤖 New build scheduled with the buildbot fleet by @encukou for commit a52be23 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F136022%2Fmerge

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 Test PR w/ buildbots; report in status section label Jul 9, 2025
@encukou

encukou commented Jul 10, 2025

Copy link
Copy Markdown
Member Author

The buildbot failures are unrelated.

@encukou

encukou commented Aug 18, 2025

Copy link
Copy Markdown
Member Author

@serhiy-storchaka, are you OK with merging this?

If you think #128444 is preferable then I'll defer to you.

@serhiy-storchaka

Copy link
Copy Markdown
Member

I think #128444 is preferable for backporting.

In 3.15 we can remove checks for the C99 features. We will have a lot of time to test this and restore workarounds if this does not work on some obscure platforms.

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

On other hand, support for non-c99 strftime was removed in 3.14 a while ago, and there were no complains during beta testing. So, this LGTM if you plan to backport it to 3.14. We should fix 3.14 in one way or another.

Comment thread Misc/NEWS.d/next/Build/2025-01-03-13-02-06.gh-issue-123681.gQ67nK.rst Outdated
@encukou
encukou requested a review from AA-Turner as a code owner August 19, 2025 07:02
@encukou
encukou merged commit 719e5c3 into python:main Aug 19, 2025
44 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @encukou for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 19, 2025
… C99 (pythonGH-136022)

A runtime check is needed to support cross-compiling.

Remove the _Py_NORMALIZE_CENTURY macro.
Remove _pydatetime.py's _can_support_c99.
(cherry picked from commit 719e5c3)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@encukou
encukou deleted the strftime-c99-always branch August 19, 2025 10:59
@bedevere-app

bedevere-app Bot commented Aug 19, 2025

Copy link
Copy Markdown

GH-137947 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Aug 19, 2025
@bedevere-bot

Copy link
Copy Markdown

encukou added a commit that referenced this pull request Oct 7, 2025
…e C99 (GH-136022) (GH-137947)

A runtime check is needed to support cross-compiling.

Remove the _Py_NORMALIZE_CENTURY macro.
Remove _pydatetime.py's _can_support_c99.
(cherry picked from commit 719e5c3)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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.

4 participants