diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-06-22 16:25:57 (GMT) |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2012-06-22 16:25:57 (GMT) |
commit | ff493c9c465ba9502629bf5001f690068be97f33 (patch) | |
tree | 199ca65706eb720a7e4dcf99dbff6e658ed0112d /Lib/datetime.py | |
parent | fdc860f3106b59ec908e0b605e51a1607ea2ff4b (diff) | |
download | cpython-ff493c9c465ba9502629bf5001f690068be97f33.zip cpython-ff493c9c465ba9502629bf5001f690068be97f33.tar.gz cpython-ff493c9c465ba9502629bf5001f690068be97f33.tar.bz2 |
Issue #9527: datetime.astimezone() method will now supply a class
timezone instance corresponding to the system local timezone when
called with no arguments.
Diffstat (limited to 'Lib/datetime.py')
-rw-r--r-- | Lib/datetime.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/datetime.py b/Lib/datetime.py index ce88d85..e4d7161 100644 --- a/Lib/datetime.py +++ b/Lib/datetime.py @@ -1501,7 +1501,7 @@ class datetime(date): localtm = _time.localtime(ts) local = datetime(*localtm[:6]) try: - # Extract TZ data if available + # Extract TZ data if available gmtoff = localtm.tm_gmtoff zone = localtm.tm_zone except AttributeError: @@ -1517,7 +1517,7 @@ class datetime(date): tz = timezone(delta) else: tz = timezone(timedelta(seconds=-gmtoff), zone) - + elif not isinstance(tz, tzinfo): raise TypeError("tz argument must be an instance of tzinfo") |