[issue20220] TarFile.list() outputs wrong time

Antoine Pitrou report at bugs.python.org
Wed Nov 5 19:13:08 CET 2014


Antoine Pitrou added the comment:

First unsetting TZ seems to fix it:

diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -1507,11 +1507,11 @@ def run_with_tz(tz):
             try:
                 return func(*args, **kwds)
             finally:
-                if orig_tz is None:
-                    del os.environ['TZ']
-                else:
+                del os.environ['TZ']
+                time.tzset()
+                if orig_tz is not None:
                     os.environ['TZ'] = orig_tz
-                time.tzset()
+                    time.tzset()
 
         inner.__name__ = func.__name__
         inner.__doc__ = func.__doc__

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20220>
_______________________________________


More information about the Python-bugs-list mailing list