New submission from Mihai Ibanescu <mihai.ibane...@gmail.com>: If one changes from one timezone to another within the same python process, and if one tries to parse a time string that includes the timezone, the library malfunctions.
See attached script for a reproducer. The problem is that, even though time.tzset() is called, the LocaleTime persisted in the TimeRE global is not reset. In my example, the EDT timezone name, compiled from the previous TZ variable, is not valid anymore in the 'Pacific/Fiji' timezone. To witness the behavior, run the attached script with no arguments. It will parse the time in the America/New_York timezone just fine. Then run it with an argument (like python ttime.py 1). It will first prime the _strptime cache in the Pacific/Fiji timezone, then attempt to parse the same time string in the America/New_York timezone. Finally, you can change the "if 0" to "if 1" for working around the problem. This has been verified in 2.4.4 and 2.6.1 (did not have a chance to verify it against python 2.6.2 yet). ---------- components: Library (Lib) files: ttime.py messages: 90497 nosy: mibanescu severity: normal status: open title: time.tzset does not reset _strptime's locale time cache type: behavior versions: Python 2.4, Python 2.6 Added file: http://bugs.python.org/file14496/ttime.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6478> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com