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

MNT: Remove use of utcnow() and change to naive datetimes instead. #1450

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

greglucas
Copy link
Contributor

utcnow() is deprecated since Python 3.12 in preference of now(UTC). However, here st_time actually returns a naive datetime, so doing now(UTC) returns a TypeError because you can't subtract a naive time from a timezone aware time. So, I think we should actually be using whatever the system is reporting for the timezone with just now().

https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow

Copy link

codecov bot commented Oct 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.50%. Comparing base (efa3faa) to head (b0803fd).
Report is 54 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1450      +/-   ##
==========================================
+ Coverage   96.40%   96.50%   +0.09%     
==========================================
  Files          20       20              
  Lines        1810     1830      +20     
==========================================
+ Hits         1745     1766      +21     
+ Misses         65       64       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@snowman2 snowman2 added this to the 3.7.1 milestone Oct 9, 2024
@snowman2 snowman2 added the bug label Oct 9, 2024
@snowman2
Copy link
Member

snowman2 commented Oct 9, 2024

Thanks @greglucas 👍

@snowman2 snowman2 merged commit f00ae91 into pyproj4:main Oct 9, 2024
18 checks passed
@greglucas greglucas deleted the datetime-warning branch October 9, 2024 03:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants