]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #665194: Added a small optimization
authorAlexander Belopolsky <alexander.belopolsky@gmail.com>
Thu, 23 Aug 2012 03:02:36 +0000 (23:02 -0400)
committerAlexander Belopolsky <alexander.belopolsky@gmail.com>
Thu, 23 Aug 2012 03:02:36 +0000 (23:02 -0400)
Lib/email/utils.py

index f32cdd931486d0fd8c612027603c11f3d9bd7f20..73bc3481d637779cb9f3badf20368ae6b67d9840 100644 (file)
@@ -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