Message254643
| 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:38 | martin.panter | set | recipients:
+ martin.panter, belopolsky, vstinner, serhiy.storchaka |
| 2015年11月14日 08:02:38 | martin.panter | set | messageid: <1447488158.12.0.299820745507.issue25168@psf.upfronthosting.co.za> |
| 2015年11月14日 08:02:38 | martin.panter | link | issue25168 messages |
| 2015年11月14日 08:02:37 | martin.panter | create |
|