You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that the codebase uses datetime.utcnow() or datetime.utcfromtimestamp(). These are deprecated and won't work with Python 3.12. They also handle naïve datetimes, which can lead to bugs. Could we switch to timezone-aware alternatives?
Hi there! 👋
I noticed that the codebase uses
datetime.utcnow()
ordatetime.utcfromtimestamp()
. These are deprecated and won't work with Python 3.12. They also handle naïve datetimes, which can lead to bugs. Could we switch to timezone-aware alternatives?CodeQL Alerts
Here are the specific instances CodeQL flagged:
feathub/python/feathub/registries/mysql_registry.py
Line 173 in 15d6382
Explanation
Issue:
datetime.utcnow()
anddatetime.utcfromtimestamp()
return naïve datetimes (without timezone info).Example Problem:
Recommended Solution:
Switch to time zone-aware methods:
Action Required:
datetime.utcnow()
withdatetime.now(tz=timezone.utc)
.datetime.utcfromtimestamp()
withdatetime.fromtimestamp(ts, tz=timezone.utc)
.References:
For more details, see:
Thank you so much for your time and effort in maintaining this project! 🌟
Best,
Shrey
The text was updated successfully, but these errors were encountered: