Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of deprecated datetime.datetime methods #71

Merged

Conversation

jakelishman
Copy link
Contributor

@jakelishman jakelishman commented Sep 22, 2023

The methods datetime.datetime.utc and .utcfromtimestamp were marked deprecated in Python 3.12 in favour of now(tz=datetime.timezone.utc) and fromtimestamp(tz=datetime.timezone.utc) 1.

The deprecation does note that there's a small slowdown from the newer methods, but it's on the order of a microsecond. I didn't change any of the use of iso8601.UTC into datetime.timezone.utc, but in practice the iso8601 module just re-exports the standard-library object as its own UTC object.

Footnotes

  1. https://github.com/python/cpython/issues/103857

The methods `datetime.datetime.utc` and `.utcfromtimestamp` were marked
deprecated in Python 3.12 in favour of `now(tz=datetime.timezone.utc)`
and `fromtimestamp(tz=datetime.timezone.utc)` [1].

[1]: python/cpython#103857
Copy link
Contributor

@mtreinish mtreinish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this seems straightforward enough

@mtreinish mtreinish merged commit 319b70b into testing-cabal:master Sep 22, 2023
6 checks passed
@jakelishman jakelishman deleted the fix-deprecated-datetime-methods branch September 22, 2023 18:14
mtreinish added a commit to mtreinish/subunit that referenced this pull request Nov 17, 2023
This commit adds explicit support and testing for Python 3.12 to
python-subunit. Since testing-cabal#71 everything should be working fine when running
python-subunit with 3.12, this commit adds CI tests to verify this on
every commit and also marks 3.12 as explicitly supported in the trove
classifiers in the package metadata.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants