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-34903: For datetime.datetime.strptime(), the leading zero for some two-digit formats is optional. #14149

Merged
merged 10 commits into from
Jun 18, 2019

Conversation

mikegleen
Copy link
Contributor

@mikegleen mikegleen commented Jun 17, 2019

This pull request replaces #9747 which I am closing. Sorry, couldn't figure out how to cleanly update the original.

I am adding tests to datetimetester.py following discussion with Paul Ganssle. Please let me know if this causes a problem.

https://bugs.python.org/issue34903

@mangrisano
Copy link
Contributor

/cc @abalkin

Copy link
Member

@pganssle pganssle left a comment

Choose a reason for hiding this comment

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

These changes look mostly pretty good, I've commented inline with some nitpicks.

One thing I don't want to get lost in the migration from #9747 is that Brett suggested that the tests be moved to test_strptime. I gave my reasoning why I think datetimetester.py in this comment on the original issue, but I would like @brettcannon to weigh in on this before just overriding his suggestion.

Finally, I should note that once the changes are approved, I'd like to run these tests against the buildbots before merging. strptime and strftime are particularly sensitive to weird edge cases on the "long tail" platforms, so changes like this are very likely to need adjustment after they've been run on the buildbots.

Lib/test/datetimetester.py Outdated Show resolved Hide resolved
Lib/test/datetimetester.py Outdated Show resolved Hide resolved
@bedevere-bot
Copy link

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.

@mikegleen
Copy link
Contributor Author

mikegleen commented Jun 17, 2019 via email

@mikegleen
Copy link
Contributor Author

I have made the requested changes; please review again.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@pganssle: please review the changes made to this pull request.

@@ -0,0 +1 @@
Documented that in :meth:datetime.datetime.strptime(), the leading zero in some two-digit formats is optional. Patch by Mike Gleen.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Documented that in :meth:datetime.datetime.strptime(), the leading zero in some two-digit formats is optional. Patch by Mike Gleen.
Documented that in :meth:`datetime.datetime.strptime()`, the leading zero in some two-digit formats is optional. Patch by Mike Gleen.

This needs backticks so Sphinx can turn it into a link to the relevant method.

@pganssle
Copy link
Member

@mikegleen Thanks Mike, these changes look good to me! I made one last edit suggestion inline to fix an issue with the What's New. I'm finding it a bit hard to interpret the CI failures, but it's just the documentation builds that are failing, so it's possible that that's just a linter detecting the missing backticks.

Add backticks so Sphinx can turn the method name into a link to the relevant method.
@mikegleen
Copy link
Contributor Author

mikegleen commented Jun 17, 2019 via email

@pganssle pganssle dismissed their stale review June 17, 2019 18:24

Requested changes have been made.

@brettcannon
Copy link
Member

No wrath from me. 😉 At this point my review is "whatever @pganssle says".

@brettcannon brettcannon removed their request for review June 18, 2019 00:42
Copy link
Member

@pganssle pganssle left a comment

Choose a reason for hiding this comment

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

I ran this through the buildbots yesterday and it did not create any new failures. The only semi-related failure was on Alpine Linux, but that is related to an earlier PR, so it seems like this documentation is accurate for all supporting platforms.

Thanks @mikegleen!

@mikegleen
Copy link
Contributor Author

I have made the requested changes; please review again.

Thanks to the core devs and administrators (and bots) who patiently walked me through this really minor fix. I am sure that I've benefited more learning about the dev process than Python will benefit from the actual code change.

@bedevere-bot
Copy link

Thanks for making the requested changes!

@vstinner, @pganssle: please review the changes made to this pull request.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM.

@pganssle
Copy link
Member

pganssle commented Jun 18, 2019

Thanks for the review @vstinner. I can merge this when the CI passes unless there are any other objections.

Since this is just a documentation fix (with tests!), we can also backport to Python 3.7.

@pganssle
Copy link
Member

There was a failure in the Mac PR that looked unrelated, seemed like the multiprocessing tests hung for about 56 minutes. Assuming it wasn't just some other kind of weird fluke, I suppose it could be a race condition in the multiprocessing tests, but I don't think it's related to this PR, so I'm going to go ahead and merge.

I'll try to dig up the broken log a bit later and see if it's worth reporting.

@pganssle pganssle merged commit 6b9c204 into python:master Jun 18, 2019
@miss-islington
Copy link
Contributor

Thanks @mikegleen for the PR, and @pganssle for merging it 🌮🎉.. I'm working now to backport this PR to: 3.7.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-14205 is a backport of this pull request to the 3.7 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 18, 2019
…ythonGH-14149)

For datetime.datetime.strptime(), the leading zero for some two-digit formats is optional.

This adds a footnote to the strftime/strptime documentation to reflect this fact, and adds some tests to ensure that it is true.

bpo-34903
(cherry picked from commit 6b9c204)

Co-authored-by: Mike Gleen <mike.gleen@gmail.com>
@ZackerySpytz
Copy link
Contributor

@pganssle This PR should also be backported to 3.8, no?

miss-islington added a commit that referenced this pull request Jun 18, 2019
…H-14149)

For datetime.datetime.strptime(), the leading zero for some two-digit formats is optional.

This adds a footnote to the strftime/strptime documentation to reflect this fact, and adds some tests to ensure that it is true.

bpo-34903
(cherry picked from commit 6b9c204)

Co-authored-by: Mike Gleen <mike.gleen@gmail.com>
@pganssle
Copy link
Member

@ZackerySpytz Oh jeez, I completely forgot that master isn't 3.8 anymore! Thanks!

@miss-islington
Copy link
Contributor

Thanks @mikegleen for the PR, and @pganssle for merging it 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@bedevere-bot
Copy link

GH-14206 is a backport of this pull request to the 3.8 branch.

miss-islington added a commit that referenced this pull request Jun 18, 2019
…H-14149)

For datetime.datetime.strptime(), the leading zero for some two-digit formats is optional.

This adds a footnote to the strftime/strptime documentation to reflect this fact, and adds some tests to ensure that it is true.

bpo-34903
(cherry picked from commit 6b9c204)

Co-authored-by: Mike Gleen <mike.gleen@gmail.com>
@vstinner
Copy link
Member

vstinner commented Jun 18, 2019 via email

lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
…ythonGH-14149)

For datetime.datetime.strptime(), the leading zero for some two-digit formats is optional.

This adds a footnote to the strftime/strptime documentation to reflect this fact, and adds some tests to ensure that it is true.

bpo-34903
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
…ythonGH-14149)

For datetime.datetime.strptime(), the leading zero for some two-digit formats is optional.

This adds a footnote to the strftime/strptime documentation to reflect this fact, and adds some tests to ensure that it is true.

bpo-34903
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