From ef10f7ee64f114e16c231350ceb2cc8cfff85bf6 Mon Sep 17 00:00:00 2001 From: Alexander Belopolsky Date: Fri, 8 Jun 2018 18:23:13 -0400 Subject: [PATCH] bpo-33810 Remove unused code from datetime.py. Since implementation of bpo-25283, the objects returned by time.localtime always have tm_zone and tm_gmtoff attributes. Remove code that anticipates their absence. --- Lib/datetime.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Lib/datetime.py b/Lib/datetime.py index 8fa18a78932c04..5e9aab97002a75 100644 --- a/Lib/datetime.py +++ b/Lib/datetime.py @@ -1759,17 +1759,10 @@ def _local_timezone(self): ts = (self - _EPOCH) // timedelta(seconds=1) localtm = _time.localtime(ts) local = datetime(*localtm[:6]) - try: - # Extract TZ data if available - gmtoff = localtm.tm_gmtoff - zone = localtm.tm_zone - except AttributeError: - delta = local - datetime(*_time.gmtime(ts)[:6]) - zone = _time.strftime('%Z', localtm) - tz = timezone(delta, zone) - else: - tz = timezone(timedelta(seconds=gmtoff), zone) - return tz + # Extract TZ data + gmtoff = localtm.tm_gmtoff + zone = localtm.tm_zone + return timezone(timedelta(seconds=gmtoff), zone) def astimezone(self, tz=None): if tz is None: pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy