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-31327: Update time documentation to reflect possible errors #31460

Merged
merged 3 commits into from Mar 11, 2022

Conversation

slateny
Copy link
Contributor

@slateny slateny commented Feb 21, 2022

As per the comments, this mirrors the datetime documentation.

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

https://bugs.python.org/issue31327

Automerge-Triggered-By: GH:pganssle

Copy link
Member

@zooba zooba left a 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

Doc/library/time.rst Outdated Show resolved Hide resolved
Doc/library/time.rst Outdated Show resolved Hide resolved
@slateny
Copy link
Contributor Author

slateny commented Feb 27, 2022

@zooba Fixed trailing spaces, could you take another look?

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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

Copy link
Contributor Author

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.

@slateny slateny changed the title bpo-31327: Updated time documentation to reflect possible errors bpo-31327: Update time documentation to reflect possible errors Mar 4, 2022
@pganssle pganssle added needs backport to 3.8 only security fixes needs backport to 3.9 only security fixes needs backport to 3.10 only security fixes labels Mar 11, 2022
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.

Looks good, thanks @slateny!

@miss-islington
Copy link
Contributor

Thanks @slateny for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8, 3.9, 3.10.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-31825 is a backport of this pull request to the 3.10 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 11, 2022
…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>
@bedevere-bot bedevere-bot removed the needs backport to 3.9 only security fixes label Mar 11, 2022
@bedevere-bot
Copy link

GH-31826 is a backport of this pull request to the 3.9 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 11, 2022
…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>
miss-islington added a commit that referenced this pull request Mar 11, 2022
…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>
miss-islington added a commit that referenced this pull request Mar 11, 2022
…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>
@slateny slateny deleted the s/time branch March 12, 2022 04:07
@iritkatriel
Copy link
Member

@pganssle Did you intend to add the backport to 3.8 label?

@pganssle
Copy link
Member

@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.

@iritkatriel
Copy link
Member

@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?

ambv pushed a commit that referenced this pull request Mar 16, 2022
…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>
hello-adam pushed a commit to hello-adam/cpython that referenced this pull request Jun 2, 2022
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir needs backport to 3.8 only security fixes skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants