#29546 closed Cleanup/optimization (fixed)
deprecate timezone.FixedOffset in favor of datetime.timezone
Reported by: | Sergey Fedoseev | Owned by: | Sergey Fedoseev |
---|---|---|---|
Component: | Utilities | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
We have FixedOffset
class each instance of which represents a timezone defined by a fixed offset from UTC, in Python 3.2 was added datetime.timezone
class needed for the same purpose, so now we can get rid of our implementation.
The possible pitfall is that FixedOffset.dst()
returns timedelta(0)
, but datetime.timezone.dst()
returns None
.
Change History (6)
comment:1 by , 6 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 6 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:3 by , 6 years ago
Has patch: | set |
---|
comment:4 by , 6 years ago
Perhaps the deprecation should be delayed and included in #27753, otherwise projects that want to continue to support Python2 won't be able to avoid the deprecation warning. Django's usage of FixedOffset
could be removed now. Well, I don't think FixedOffset
is something that many (if any) third-party packages are relying on.
PR