Skip to content

Conversation

gilles-peskine-arm
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm commented Jun 11, 2025

Get rid of harmless warnings when you run assemble_changelog.py with Python ≥3.12. We're using a deprecated function datetime.datetime.utcfromtimestamp, but we happen to be using it safely, and at the time of posting the function hasn't been removed yet.

This is the only script where we use datetime.datetime.utcfromtimestamp.

PR checklist

  • TF-PSA-Crypto PR not required because: only refactoring
  • development PR not required because: only refactoring
  • 3.6 PR not required because: only refactoring

Replace `datetime.datetime.utcfromtimestamp`, which is deprecated since
Python 3.12, by `datetime.datetime.fromtimestamp` on
`datetime.timezone.utc`, which has existed since Python 3.2.

Also fix file timestamps, which were in the local time zone rather than UTC.
This had no practical consequence since the script only uses those
timestamps to compare with other file timestamps. (In particular, all
uncommitted files are ordered after all committed files, so the script never
compares a formerly-UTC timestamp of a committed file to a formerly-local
timestamp of an uncommitted file.)

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review priority-medium Medium priority - this can be reviewed as time permits size-xs Estimated task size: extra small (a few hours at most) labels Jun 11, 2025
@gilles-peskine-arm gilles-peskine-arm changed the title Clean up datetime.fromtimestamp timezone handling assemble_changelog.py: Clean up datetime.fromtimestamp timezone handling Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review priority-medium Medium priority - this can be reviewed as time permits size-xs Estimated task size: extra small (a few hours at most)
Projects
Status: In Development
Development

Successfully merging this pull request may close these issues.

1 participant