[Python-checkins] cpython: Closes #14902: Fixed timezone conversion of a date/time in the past. Thanks to
vinay.sajip
python-checkins at python.org
Tue Jul 3 22:36:59 CEST 2012
http://hg.python.org/cpython/rev/56260d30985d
changeset: 77939:56260d30985d
user: Vinay Sajip <vinay_sajip at yahoo.co.uk>
date: Tue Jul 03 21:36:36 2012 +0100
summary:
Closes #14902: Fixed timezone conversion of a date/time in the past. Thanks to Yuriy Syrovetskiy for the report and Juancarlo Añez for the patch on which this fix is based.
files:
Lib/test/test_logging.py | 6 ++++--
Misc/ACKS | 2 ++
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_logging.py b/Lib/test/test_logging.py
--- a/Lib/test/test_logging.py
+++ b/Lib/test/test_logging.py
@@ -2899,8 +2899,10 @@
def test_time(self):
r = self.get_record()
- dt = datetime.datetime(1993,4,21,8,3,0,0,utc)
- r.created = time.mktime(dt.timetuple()) - time.timezone
+ dt = datetime.datetime(1993, 4, 21, 8, 3, 0, 0, utc)
+ # We use None to indicate we want the local timezone
+ # We're essentially converting a UTC time to local time
+ r.created = time.mktime(dt.astimezone(None).timetuple())
r.msecs = 123
f = logging.Formatter('%(asctime)s %(message)s')
f.converter = time.gmtime
diff --git a/Misc/ACKS b/Misc/ACKS
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -33,6 +33,7 @@
Erik Andersén
Oliver Andrich
Ross Andrus
+Juancarlo Añez
Jérémy Anger
Jon Anglin
Éric Araujo
@@ -1167,3 +1168,4 @@
Kai Zhu
Tarek Ziadé
Peter Åstrand
+
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list