-
-
Notifications
You must be signed in to change notification settings - Fork 393
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
Avoid usage of deprecated datetime.datetime.utcfromtimestamp
in pendulum.from_timestamp
#803
base: master
Are you sure you want to change the base?
Avoid usage of deprecated datetime.datetime.utcfromtimestamp
in pendulum.from_timestamp
#803
Conversation
…ndulum.from_timestamp`
CodSpeed Performance ReportMerging #803 will not alter performanceComparing Summary
|
Related: python-pendulum/pendulum#696 Unit tests showing deprecation warnings, see python-pendulum/pendulum#803
dt = datetime( | ||
dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second, dt.microsecond | ||
) | ||
dt = DateTime.fromtimestamp(timestamp, tz=UTC) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the current suggestion is recursive and does not use the correct keyword:
dt = DateTime.fromtimestamp(timestamp, tz=UTC) | |
dt = _datetime.datetime.fromtimestamp(timestamp, tzinfo=UTC) |
For the develop branch, the change must be done in pendulum/pendulum.py:491
dt = datetime.datetime.utcfromtimestamp(timestamp).replace(tzinfo=UTC)
to
dt = datetime.datetime.fromtimestamp(timestamp, tzinfo=UTC)
Related: python-pendulum/pendulum#696 Unit tests showing deprecation warnings, see python-pendulum/pendulum#803
Also interested in this fix; is there help needed to get this through? (I see a failing test, but unsure if that's accurate as this is pretty old.) |
Pull Request Check List
datetime.datetime.utcfromtimestamp()
is deprecated into the Python 3.12 as result current implementation raise warning message/usr/local/lib/python3.12/site-packages/pendulum/__init__.py:295 DeprecationWarning: datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: