Martin Panter added the comment:
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'
----------
components: +Tests
nosy: +martin.panter
type: -> behavior
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue25168>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com