mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #9527: datetime.astimezone() method will now supply a class
timezone instance corresponding to the system local timezone when called with no arguments.
This commit is contained in:
parent
fdc860f310
commit
ff493c9c46
2 changed files with 4 additions and 4 deletions
|
@ -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")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue