sopel-irc / sopel

:robot::speech_balloon: An easy-to-use and highly extensible IRC Bot framework. Formerly Willie.
https://sopel.chat
Other
950 stars 405 forks source link

Replace uses of deprecated `datetime.utcnow()` #2468

Closed dgw closed 1 year ago

dgw commented 1 year ago

Description

As @SnoopJ mentioned on IRC right after opening #2457, datetime.utcnow() is deprecated in Python 3.12 (and also datetime.utcfromtimestamp()). The recommended replacements for those items have been usable for most of Python 3's history—though we don't get to usedatetime.UTC instead of datetime.timezone.utc until Python 3.11 is our minimum version.

Checklist

Notes

As often happens when I poke at stuff, there are some minor documentation corrections lumped in here that I didn't think warranted (a) separate PR(s).

I wanted to go further with this and get rid of pytz, but zoneinfo isn't available until Python 3.9. (There is a backports.zoneinfo package, but it hasn't been updated in a while and its issue tracker is starting to fill with reports of errors & warnings.)