[issue24929] _strptime.TimeRE should not enforce range in regex

2015-09-01 Thread Steve Yeung

Steve Yeung added the comment:

I'm not sure what format I'm supposed to provide the test in. I attached a file 
that has the diff of the changes I made, and how the error message is changed 
(and improved!) in both datetime and time.

--
Added file: http://bugs.python.org/file40319/file

___
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue24929>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue24929] _strptime.TimeRE should not enforce range in regex

2015-08-24 Thread Steve Yeung

New submission from Steve Yeung:

Currently, the regex in TimeRE enforces the numeric ranges. For example:
'm': r(?Pm1[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(?Pm\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.

--
components: Library (Lib)
messages: 249074
nosy: Steve Yeung
priority: normal
severity: normal
status: open
title: _strptime.TimeRE should not enforce range in regex
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue24929
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com