Erik Cederstrand added the comment:
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")
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue12006>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com