News for hackers. Stuff that matters.
Re:It's Time for a Change: Datetime.utcnow() Is Now Deprecated by Hamuko on Sunday November 19, 2023 @10:59AM (#38333823)
I'd say that wouldn't enforcement be rather simple going forwards since you could just enforce that dt.tzinfo == datetime.timezone.utc, but as far as I know, timezone information checking in Python can be a bit of a pain.

  >>> utc1 = datetime.timezone.utc
  >>> utc2 = zoneinfo.ZoneInfo("UTC")
  >>> utc1 == utc2
  False
  >>> dt1 = datetime.datetime.now(utc1)
  >>> dt2 = datetime.datetime.now(utc2)
  >>> dt1.tzinfo == dt2.tzinfo
  False

There are no comments on this comment yet.