cherrypy / cherrypy

CherryPy is a pythonic, object-oriented HTTP framework. https://cherrypy.dev
https://docs.cherrypy.dev
BSD 3-Clause "New" or "Revised" License
1.8k stars 357 forks source link

Replace deprecated `datetime.utcnow()` w/ a tz-aware variant #2007

Closed radez closed 5 months ago

radez commented 6 months ago

Calling datetime.datetime.utcnow() emits a deprecation warning now. Python 3.12 reports:

DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC).

This patch replaces it with a non-deprecated cross-python implementation.

What kind of change does this PR introduce?

Checklist:

webknjaz commented 5 months ago

I have clicked the "Rebase" button via GH UI.