This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients belopolsky, martin.panter, serhiy.storchaka, vstinner
Date 2015-11-14.08:02:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1447488158.12.0.299820745507.issue25168@psf.upfronthosting.co.za>
In-reply-to
Content
I wonder if this has anything to do with _strptime._TimeRE_cache. This seems to get initialized when _strptime is first imported. Some of the tests in datetimetester temporarily set the timezone to -0500 EST, and another to UTC, but they change it back afterwards. So I cannot see how it could have an effect, but I don’t have a better theory.

>>> import _strptime  # Regular expression cache is initialized
>>> _strptime._TimeRE_cache["Z"]  # I don't have a time zone set
'(?P<Z>gmt|utc)'
>>> import os, time
>>> os.environ["TZ"] = 'EST+05EDT,M3.2.0,M11.1.0'
>>> time.tzset()
>>> time.tzname
('EST', 'EDT')
>>> from datetime import datetime
>>> datetime.strptime("-0500 EST", "%z %Z")  # Using original cache
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/proj/python/cpython/Lib/_strptime.py", line 555, in _strptime_datetime
    tt, fraction = _strptime(data_string, format)
  File "/home/proj/python/cpython/Lib/_strptime.py", line 356, in _strptime
    (data_string, format))
ValueError: time data '-0500 EST' does not match format '%z %Z'
History
Date User Action Args
2015-11-14 08:02:38martin.pantersetrecipients: + martin.panter, belopolsky, vstinner, serhiy.storchaka
2015-11-14 08:02:38martin.pantersetmessageid: <1447488158.12.0.299820745507.issue25168@psf.upfronthosting.co.za>
2015-11-14 08:02:38martin.panterlinkissue25168 messages
2015-11-14 08:02:37martin.pantercreate