Skip to content

Commit 71d7a1b

Browse files
authored
Rollup merge of #131703 - alex:patch-1, r=Kobzol
Resolved python deprecation warning in publish_toolstate.py `utcnow()` is deprecated in favor of passing a timezone to `now()`. `utcnow()` would return a tz-naive datetime, while this returns a tz-aware datetime. For the purposes of the formatting we do, these are the same.
2 parents 55016c8 + eb6062c commit 71d7a1b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/tools/publish_toolstate.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,9 @@ def update_latest(
235235
exit(0)
236236

237237
cur_commit = sys.argv[1]
238-
cur_datetime = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')
238+
cur_datetime = datetime.datetime.now(datetime.timezone.utc).strftime(
239+
'%Y-%m-%dT%H:%M:%SZ'
240+
)
239241
cur_commit_msg = sys.argv[2]
240242
save_message_to_path = sys.argv[3]
241243
github_token = sys.argv[4]

0 commit comments

Comments
 (0)