Mercurial > p > roundup > code
view roundup/anypy/datetime_.py @ 7589:6894f152d49a
fix: issue2551278 - datetime.datetime.utcnow deprecation.
Original fix always failed the import and fell back to the exception case.
This method should work and test both code paths in datetime_.py.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 26 Jul 2023 23:59:35 -0400 |
| parents | 8f29e4ea05ce |
| children | d5d7ecd31864 |
line wrap: on
line source
# https://issues.roundup-tracker.org/issue2551278 # datetime.utcnow deprecated try: from datetime import datetime, UTC def utcnow(): return datetime.now(UTC) except ImportError: from datetime import datetime def utcnow(): return datetime.utcnow()
