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 Steve Yeung
Recipients Steve Yeung
Date 2015-08-24.21:39:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1440452349.29.0.876134082373.issue24929@psf.upfronthosting.co.za>
In-reply-to
Content
Currently, the regex in TimeRE enforces the numeric ranges. For example:
    'm': r"(?P<m>1[0-2]|0[1-9]|[1-9])",

As a result, an invalid month will cause an generic regex error:
    ValueError: time data '2015/16/5' does not match format '%Y/%m/%d'

However, if we relax the regex to not check the range and allow datetime to handle it:
    'm': r"(?P<m>\d{1,2})"

The error will be handle in datetime instead and the error will be much more helpful:
    ValueError: month must be in 1..12

Please consider relaxing the regex for numeric ranges in _strptime.TimeRE.
History
Date User Action Args
2015-08-24 21:39:09Steve Yeungsetrecipients: + Steve Yeung
2015-08-24 21:39:09Steve Yeungsetmessageid: <1440452349.29.0.876134082373.issue24929@psf.upfronthosting.co.za>
2015-08-24 21:39:09Steve Yeunglinkissue24929 messages
2015-08-24 21:39:09Steve Yeungcreate