mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #665194: Added a small optimization
This commit is contained in:
parent
1f924d21d3
commit
f9bd9141c5
1 changed files with 1 additions and 1 deletions
|
@ -386,7 +386,7 @@ def localtime(dt=None, isdst=-1):
|
|||
|
||||
"""
|
||||
if dt is None:
|
||||
dt = datetime.datetime.now(datetime.timezone.utc)
|
||||
return datetime.datetime.now(datetime.timezone.utc).astimezone()
|
||||
if dt.tzinfo is not None:
|
||||
return dt.astimezone()
|
||||
# We have a naive datetime. Convert to a (localtime) timetuple and pass to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue