]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
GH-103944: Remove last use of `utcfromtimestamp` (#103995)
authorPaul Ganssle <1377457+pganssle@users.noreply.github.com>
Wed, 3 May 2023 15:17:27 +0000 (11:17 -0400)
committerGitHub <noreply@github.com>
Wed, 3 May 2023 15:17:27 +0000 (11:17 -0400)
commit38dc3f28dde92b4fa6284a57f4e554991a3d9276
tree13e9d86cf177a8b3a3d9ab76a88d81abb9ef2905
parent0fc58c66bafbd20f02c206c801cf9ab939853164
GH-103944: Remove last use of `utcfromtimestamp` (#103995)

* Remove last use of `utcfromtimestamp`

This was a weirdly valid use of `utcfromtimestamp` in the sense that the "timestamps" in TZif files are not epoch times, but actually something more properly thought of as "number of seconds since 1970 in the local time zone", so even though we didn't want UTC time, `utcfromtimestamp` was still a good way to get the thing we wanted. Since we're deprecating `utcfromtimestamp`, it's just as valid to use `timedelta` arithmetic here.

We may be able to avoid the question entirely by switching these tests over to using `ZoneInfo` in the future.

* Fix a few missing DeprecationWarnings in tests

In one test, we simply turn off DeprecationWarning rather than asserting about it, because whether the error condition happens before or after the warning seems to differ between the Python and C versions.
Lib/test/datetimetester.py