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-31327: Update time documentation to reflect possible errors #31460
Conversation
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.
Approved with the CI fixes
@zooba Fixed trailing spaces, could you take another look? |
Doc/library/time.rst
Outdated
the range of values supported by the platform C :c:func:`localtime` or | ||
:c:func:`gmtime` functions, and :exc:`OSError` on :c:func:`localtime` or | ||
:c:func:`gmtime` failure. | ||
It's common for this to be restricted to years in |
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.
It's common for this to be restricted to years in | |
It's common for this to be restricted to years in the range of |
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 just copied-pasted from datetime
, but if we're to change the wording then there's some shorter options as well:
"... to be restricted to the years 1970 through 2038."
or
"... years in the range 1970 to 2038."
Though difficult for me to say which one of the three is the best 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.
Looks good, thanks @slateny!
Thanks @slateny for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9, 3.10. |
GH-31825 is a backport of this pull request to the 3.10 branch. |
…onGH-31460) As per the comments, this mirrors the [datetime documentation](https://docs.python.org/3/library/datetime.htmlGH-datetime.datetime.fromtimestamp). ``` >>> import time >>> time.localtime(999999999999999999999) Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: timestamp out of range for platform time_t >>> time.localtime(-3600) Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: [Errno 22] Invalid argument ``` (cherry picked from commit c83fc9c) Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
GH-31826 is a backport of this pull request to the 3.9 branch. |
…onGH-31460) As per the comments, this mirrors the [datetime documentation](https://docs.python.org/3/library/datetime.htmlGH-datetime.datetime.fromtimestamp). ``` >>> import time >>> time.localtime(999999999999999999999) Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: timestamp out of range for platform time_t >>> time.localtime(-3600) Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: [Errno 22] Invalid argument ``` (cherry picked from commit c83fc9c) Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
…1460) As per the comments, this mirrors the [datetime documentation](https://docs.python.org/3/library/datetime.htmlGH-datetime.datetime.fromtimestamp). ``` >>> import time >>> time.localtime(999999999999999999999) Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: timestamp out of range for platform time_t >>> time.localtime(-3600) Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: [Errno 22] Invalid argument ``` (cherry picked from commit c83fc9c) Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
…1460) As per the comments, this mirrors the [datetime documentation](https://docs.python.org/3/library/datetime.htmlGH-datetime.datetime.fromtimestamp). ``` >>> import time >>> time.localtime(999999999999999999999) Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: timestamp out of range for platform time_t >>> time.localtime(-3600) Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: [Errno 22] Invalid argument ``` (cherry picked from commit c83fc9c) Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
@pganssle Did you intend to add the backport to 3.8 label? |
@iritkatriel It's a doc fix, not sure how far we usually backport those since they are not critical bit also not likely to cause any problems, so I went with backporting as far as it would go. If you think there's no reason to go that far back I don't feel strongly about it at all. |
I don’t have a view on this (and I didn’t know we backport doc fixes to 3.8). In this particular case it seems like the 3.8 backport did not happen - maybe the bots don’t do them based on labels? |
…1460) (GH-31827) As per the comments, this mirrors the [datetime documentation](https://docs.python.org/3/library/datetime.htmlGH-datetime.datetime.fromtimestamp). ``` >>> import time >>> time.localtime(999999999999999999999) Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: timestamp out of range for platform time_t >>> time.localtime(-3600) Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: [Errno 22] Invalid argument ``` (cherry picked from commit c83fc9c) Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
…onGH-31460) As per the comments, this mirrors the [datetime documentation](https://docs.python.org/3/library/datetime.htmlGH-datetime.datetime.fromtimestamp). ``` >>> import time >>> time.localtime(999999999999999999999) Traceback (most recent call last): File "<stdin>", line 1, in <module> OverflowError: timestamp out of range for platform time_t >>> time.localtime(-3600) Traceback (most recent call last): File "<stdin>", line 1, in <module> OSError: [Errno 22] Invalid argument ``` (cherry picked from commit c83fc9c) Co-authored-by: slateny <46876382+slateny@users.noreply.github.com>
As per the comments, this mirrors the datetime documentation.
https://bugs.python.org/issue31327
Automerge-Triggered-By: GH:pganssle