mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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:
parent
a5308e188b
commit
0b7fd8ffc5
10 changed files with 101 additions and 34 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue