Message227409
| Author |
Erik Cederstrand |
| Recipients |
AaronR, Alex.Willmer, BreamoreBoy, Erik Cederstrand, Erik.Cederstrand, aganders3, belopolsky, r.david.murray, tim.peters |
| Date |
2014年09月24日.07:17:46 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1411543066.71.0.67432007195.issue12006@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I don't have the repo handy to make a patch against 3.5, but would an addition like this do?
in Lib/_strptime.py:
+ elif iso_week != -1 and iso_year == -1:
+ raise ValueError("'%Y' directive is ambiguous in combination with '%V'. Use '%G' instead.")
+ elif julian == -1 and iso_week != -1 and iso_weekday != -1:
+ year, julian = _calc_julian_from_V(iso_year, iso_week, iso_weekday)
In Lib/test/test_strptime.py:
def test_ValueError(self):
+ # Make sure ValueError is raised when match fails or format is bad
+ self.assertRaises(ValueError, _strptime._strptime, data_string="1905 52",
+ format="%Y %V") |
|