Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
bpo-36004: Add date.fromisocalendar#11888
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
bedevere-bot commentedFeb 17, 2019
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 |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
221f2a7 to3d3e6e7CompareLib/test/datetimetester.py Outdated
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.
One thing I'll note is that this is consistent withdatetime.date itself not accepting floats. I'm not sure how much I agree with that, I just wanted to put it in the tests to ensure consistency between the C and Python versions.
pganssle commentedFeb 18, 2019
I have made the requested changes; please review again. |
bedevere-bot commentedFeb 18, 2019
Thanks for making the requested changes! @pablogsal: please review the changes made to this pull request. |
pablogsal 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.
I think we are missing an entry inDoc/whatsnew/3.8.rst
pganssle commentedMar 17, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@pablogsal Indeed, I'm so used to adding these after the fact, it might be nice to actually have one merged with the change for once. Added. |
Dismissed my review while I have to do another one to not block the PR
Uh oh!
There was an error while loading.Please reload this page.
Lib/test/datetimetester.py Outdated
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.
Maybe use MINYEAR/MAXYEAR here.
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.
Instead of converting these over, I have just added aMINYEAR andMAXYEAR test. Even though it's redundant, I like to have the explicit callout of the current boundaries, so that ifMINYEAR orMAXYEAR get modified in a way that breaks backwards compatibility, it will raise an error.
Lib/test/datetimetester.py Outdated
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.
Would it be possible to use 3 loops to test all combinations, rather than generate these combinations manualy?
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.
OK, I've converted it over. I think it's a little harder to understand what's going on in the version where the test cases are generated (compared to manual), but using a loop also has its advantages.
vstinner commentedApr 29, 2019
I forgot to say that more generally, I like the idea. I like the proposed new constructor, it perfectly makes sense. I just have some comments on the actual implementation. |
This commit implements the first version of date.fromisocalendar, theinverse function for date.isocalendar. It is currently missing errorchecking for the case of of invalid iso dates in week 53.bpo-36004:https://bugs.python.org/issue36004
This avoids an overflow error in ordinal calculations in the Cimplementation.
This is equivalent but uses only existing helper functions and in manycases will be slightly more efficient.
vstinner 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.
LGTM.
Side note:@pganssle: maybe it would be interesting to convert datetime to Argument Clinic to provide better docstrings.
vstinner commentedApr 29, 2019
Random network issue, unrelated to this change. |
pganssle commentedApr 29, 2019
@vstinner Thanks for the review and merge, Victor! |
* Clarify impact on default behaviour of exec, eval, etc* Update documentation for changes to PyEval_GetLocals (pythongh-74929)Closespythongh-11888
* Clarify impact on default behaviour of exec, eval, etc* Update documentation for changes to PyEval_GetLocals (pythongh-74929)Closespythongh-11888(cherry picked from commit2180991)Co-authored-by: Alyssa Coghlan <ncoghlan@gmail.com>
* Clarify impact on default behaviour of exec, eval, etc* Update documentation for changes to PyEval_GetLocals (pythongh-74929)Closespythongh-11888
* Clarify impact on default behaviour of exec, eval, etc* Update documentation for changes to PyEval_GetLocals (pythongh-74929)Closespythongh-11888
* Clarify impact on default behaviour of exec, eval, etc* Update documentation for changes to PyEval_GetLocals (pythongh-74929)Closespythongh-11888
Uh oh!
There was an error while loading.Please reload this page.
This commit implements the first version of
date.fromisocalendar, the inverse function fordate.isocalendar. It is currently missing error checking for the case of of invalid ISO dates in week 53.To Do:
TypeErrorOther than these known errors, the existing code can be reviewed.Ready to go.bpo-36004
https://bugs.python.org/issue36004