diff options
| author | Alex Gaynor <alex.gaynor@gmail.com> | 2024-10-14 15:27:37 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-14 15:27:37 -0400 |
| commit | eb6062ce00cce6fa1973466e6b2fb376e3e89cc8 (patch) | |
| tree | f61bf5da1e4463745539472e5d5db3e7ed599d1c /src/tools/publish_toolstate.py | |
| parent | 9322d183f45e0fd5a509820874cc5ff27744a479 (diff) | |
| download | rust-eb6062ce00cce6fa1973466e6b2fb376e3e89cc8.tar.gz rust-eb6062ce00cce6fa1973466e6b2fb376e3e89cc8.zip | |
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.
Diffstat (limited to 'src/tools/publish_toolstate.py')
| -rwxr-xr-x | src/tools/publish_toolstate.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/tools/publish_toolstate.py b/src/tools/publish_toolstate.py index 860d21876de..328b48e04d2 100755 --- a/src/tools/publish_toolstate.py +++ b/src/tools/publish_toolstate.py @@ -235,7 +235,9 @@ try: exit(0) cur_commit = sys.argv[1] - cur_datetime = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ') + cur_datetime = datetime.datetime.now(datetime.timezone.utc).strftime( + '%Y-%m-%dT%H:%M:%SZ' + ) cur_commit_msg = sys.argv[2] save_message_to_path = sys.argv[3] github_token = sys.argv[4] |
