mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +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
|
|
@ -517,7 +517,7 @@ class DateTimeTests(unittest.TestCase):
|
|||
self.assertEqual(ts, ts2)
|
||||
|
||||
def test_sql_timestamp(self):
|
||||
now = datetime.datetime.utcnow()
|
||||
now = datetime.datetime.now(tz=datetime.UTC)
|
||||
self.cur.execute("insert into test(ts) values (current_timestamp)")
|
||||
self.cur.execute("select ts from test")
|
||||
with self.assertWarnsRegex(DeprecationWarning, "converter"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue