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 utcnow #290

Merged
merged 4 commits into from
Jun 1, 2023
Merged

Remove use of utcnow #290

merged 4 commits into from
Jun 1, 2023

Conversation

pganssle
Copy link
Contributor

utcnow will be deprecated in Python 3.12. In anticipation of this, it would be good to switch over your use of datetime.utcnow to use actual timezone-aware datetimes.

There are two commits in this PR. The first one replaces all uses of utcnow with drop-in equivalents, but doesn't solve the underlying problem. The second one converts all the use of datetime that I found to using aware datetimes instead of naïve ones. I think accepting that one would be preferable.

@pganssle
Copy link
Contributor Author

One thing to note: this is the only library that pip vendors that uses utcnow. Ideally we would get this taken care of ASAP so that it can be vendored in pip and have utcnow removed from pip entirely as soon as possible, since ideally pip would be prepared for the deprecation well in advance of the 3.12 release.

@frostming
Copy link
Contributor

@pganssle Can you please rebase the master?

This removes the use of utcnow to avoid deprecation warnings, though
ideally this would be fixed instead by switching over to using aware
datetimes instead.
@pganssle
Copy link
Contributor Author

@frostming Done.

@frostming frostming merged commit 93544ed into psf:master Jun 1, 2023
woodruffw pushed a commit to woodruffw-forks/cachecontrol that referenced this pull request Jul 9, 2024
* Remove utcnow

This removes the use of utcnow to avoid deprecation warnings, though
ideally this would be fixed instead by switching over to using aware
datetimes instead.

* Use aware datetimes

---------

Co-authored-by: Frost Ming <[email protected]>
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