-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
gh-120713: normalize year with century for datetime.strftime #120820
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
serhiy-storchaka
merged 56 commits into
python:main
from
blhsing:normalize-datetime-strftime-year-with-century
Jun 29, 2024
Merged
Changes from all commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
9022177
gh-120713: normalize year with century for datetime.strftime
blhsing a1592e3
📜🤖 Added by blurb_it.
blurb-it[bot] 48affbd
gh-120713: fixed pyconfig.h.in
blhsing 2ff6c0b
Update 2024-06-21-06-37-46.gh-issue-120713.WBbQx4.rst
blhsing ab39dd9
Update datetimetester.py
blhsing b905a4e
Update datetimetester.py
blhsing b43858e
Update _pydatetime.py
blhsing 6ca887e
gh-120713: format "%Y" with "%4d" using sprintf instead of replacing …
blhsing a9623c4
gh-120713: test that a 0-padded year with century is guaranteed
blhsing 2fc1c6a
gh-120713: revised detection logics in Python
blhsing 2c3252f
gh-120713: fixed test
blhsing 9fd3d2d
gh-120713: use "%04ld" instead of "%04d" to avoid unnecessary int con…
blhsing e64780b
gh-120713: fixed scope for formatted year buffer
blhsing 32026be
gh-120713: added #ifdef guard over formatted year buffer declaration
blhsing fed7657
gh-120713: fixed typo
blhsing 7560a60
gh-120713: account for "%G"; increase buffer for formatted year to ma…
blhsing f5508ee
gh-120713: be pessimistic when cross-compiling
blhsing abc3d21
gh-120713: call time.strftime instead to obtain the proper ISO-8601 year
blhsing ff7de92
gh-120713: align comment
blhsing 9c9e645
gh-120713: additional comment and formatting
blhsing 0f8886d
gh-120713: fixed comment
blhsing 2ff8cc5
gh-120713: streamlined C code with better error handling
blhsing 637c341
gh-120713: release reference sooner
blhsing 07327c5
gh-120713: release reference to year if created for %G
blhsing 818d1f4
Update 2024-06-21-06-37-46.gh-issue-120713.WBbQx4.rst
blhsing 7038c1d
gh-120713: made year as python string a variable separate from result…
blhsing 2fb0262
gh-120713: skip 0-padding logics if year > 1000
blhsing 96484f9
gh-120713: made python implementation skip 0-padding logics if year >…
blhsing 6c2c169
gh-120713: made C check return exit code instead of calling exit
blhsing 42244f4
removed inclusion of stdlib.h now that we don't call exit
blhsing af147f7
gh-120713: updated configure
blhsing 40ae42b
gh-120713: updated configure
blhsing fc765d0
gh-120713: removed unnecessary comment
blhsing 3cd21f0
made the method a link in the blurb
blhsing 32cc992
Update configure.ac
blhsing c506568
gh-120713: renamed macro NORMALIZE_CENTURY; moved declarations of new…
blhsing 5f8bf96
gh-120713: initialize strftime on declaration
blhsing 07df016
gh-120713: added versionchanged info in the documentation
blhsing 0588e38
gh-120713: switched to PyOS_snprintf; moved declarations closer to us…
blhsing e8bbd88
gh-120713: reverted addition of the versionchanged directive
blhsing 2ca5af6
gh-120713: moved declarations closer to usage
blhsing 451ebf1
gh-120713: initialize variables on declarations
blhsing 25e4fa5
Update Lib/test/datetimetester.py
blhsing 0656e21
Update Misc/NEWS.d/next/Library/2024-06-21-06-37-46.gh-issue-120713.W…
blhsing 049a05b
Update Modules/_datetimemodule.c
blhsing a82bca4
gh-120713: moved initialization of strftime above the first goto to a…
blhsing 492ecf9
Update Lib/test/datetimetester.py
blhsing 7d8a9f1
gh-120713: comment on why year 1000 can go on the fast path for %G
blhsing 455fa96
Update Modules/_datetimemodule.c
blhsing f299c20
Update Modules/_datetimemodule.c
blhsing fcc7c7f
Update Lib/_pydatetime.py
blhsing 3069d62
Update Modules/_datetimemodule.c
blhsing e603132
gh-120713: use sizeof instead of a variable to determine the size of …
blhsing c54739b
gh-120713: use macro instead of sizeof
blhsing 881dc1d
gh-120713: moved buffer declaration to the same scope as the ptoappen…
blhsing 0cd5e27
gh-120713: fixed typo
blhsing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
Misc/NEWS.d/next/Library/2024-06-21-06-37-46.gh-issue-120713.WBbQx4.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
:meth:`datetime.datetime.strftime` now 0-pads years with less than four digits for the format specifiers ``%Y`` and ``%G`` on Linux. | ||
Patch by Ben Hsing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.