-
-
Notifications
You must be signed in to change notification settings - Fork 34.1k
gh-57095: Add note about input splitting in datetime.*.strptime
#131049
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
Conversation
|
I don't think the behaviour is guaranteed. Can you find it some standard? IMO, it would be better to expand the note about what varies across platforms -- “The full set of format codes”, “handling of unsupported format specifiers”... and also handling of ambiguous/wrong inputs. (Even if all platforms currently agree, I don't think we should commit to their behaviour. As musl shows, there can always appear a new platform that considers it fair game to reinterpret whatever's not specified in C or POSIX.) |
He can choose to do that if he wants, I think the only thing it is hurting is his inbox 😅 WRT the change, I needed a close look to understand what this meant, which makes me think that this is not a very clear statement. It seems like what you are trying to say is something about how ambiguous format specs are parsed, correct? For example, if a code can match one digit or two, and matching two digits will fail to parse but matching one digit will succeed, it chooses one? What if you use
I agree in principle. I think if we document this behavior, we should add tests and then maybe add language like, "The behavior when parsing ambiguous strings is platform dependent. On all currently supported platforms, ". We can add a comment to the test to change the documentation if the test starts failing on a supported platform because of their implementation of strptime. (Assuming that this is not already clearly specified in the POSIX standard). |
|
Maybe the wording from the GNU docs would be better?
|
|
I don't think GNU docs have a compatible license, so we should use different wording. |
Co-authored-by: Petr Viktorin <encukou@gmail.com>
encukou
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
|
Thanks @StanFromIreland for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @StanFromIreland for the PR, and @encukou for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
…e` (pythonGH-131049) (cherry picked from commit 2e3e76e) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
…e` (pythonGH-131049) (cherry picked from commit 2e3e76e) Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com> Co-authored-by: Petr Viktorin <encukou@gmail.com>
|
GH-144734 is a backport of this pull request to the 3.13 branch. |
|
GH-144735 is a backport of this pull request to the 3.14 branch. |
📚 Documentation preview 📚: https://cpython-previews--131049.org.readthedocs.build/