GH-103857: Deprecate utcnow and utcfromtimestamp (#103858)

Using `datetime.datetime.utcnow()` and `datetime.datetime.utcfromtimestamp()` will now raise a `DeprecationWarning`.

We also have removed our internal uses of these functions and documented the change.
This commit is contained in:
Paul Ganssle 2023-04-27 11:32:30 -06:00 committed by GitHub
parent a5308e188b
commit 0b7fd8ffc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 101 additions and 34 deletions

View file

@ -925,7 +925,7 @@ class TestBinaryPlistlib(unittest.TestCase):
# Issue #26709: 32-bit timestamp out of range
for ts in -2**31-1, 2**31:
with self.subTest(ts=ts):
d = (datetime.datetime.utcfromtimestamp(0) +
d = (datetime.datetime(1970, 1, 1, 0, 0) +
datetime.timedelta(seconds=ts))
data = plistlib.dumps(d, fmt=plistlib.FMT_BINARY)
self.assertEqual(plistlib.loads(data), d)