[Python-checkins] python/dist/src/Lib _strptime.py,1.7,1.8
nnorwitz@users.sourceforge.net
nnorwitz@users.sourceforge.net
Mon, 30 Dec 2002 14:23:14 -0800
- Previous message: [Python-checkins] python/dist/src/Lib/plat-darwin IN.py,NONE,1.1 regen,NONE,1.1
- Next message: [Python-checkins] python/dist/src Makefile.pre.in,1.105,1.106 configure.in,1.380,1.381 configure,1.369,1.370
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv10964/Lib
Modified Files:
_strptime.py
Log Message:
Fix SF #658820, regex fixes for _strptime (Brett Cannon)
Disallow zero for days and months
Index: _strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** _strptime.py 26 Dec 2002 16:19:52 -0000 1.7
--- _strptime.py 30 Dec 2002 22:23:12 -0000 1.8
***************
*** 307,326 ****
def __init__(self, locale_time=LocaleTime()):
"""Init inst with non-locale regexes and store LocaleTime object."""
! # XXX: should 0 be valid for:
! # day (d), julian day (j), month (m), and hour12 (I)?
! super(TimeRE,self).__init__({
# The " \d" option is to make %c from ANSI C work
! 'd': r"(?P<d>3[0-1]|[0-2]\d|\d| \d)",
'H': r"(?P<H>2[0-3]|[0-1]\d|\d)",
! 'I': r"(?P<I>0\d|1[0-2]|\d)",
! 'j': r"(?P<j>(?:3[0-5]\d|36[0-6])|[0-2]\d\d|\d\d|\d)",
! 'm': r"(?P<m>0\d|1[0-2]|\d)",
'M': r"(?P<M>[0-5]\d|\d)",
'S': r"(?P<S>6[0-1]|[0-5]\d|\d)",
'U': r"(?P<U>5[0-3]|[0-4]\d|\d)",
'w': r"(?P<w>[0-6])",
! 'W': r"(?P<W>5[0-3]|[0-4]\d|\d)", # Same as U
'y': r"(?P<y>\d\d)",
'Y': r"(?P<Y>\d\d\d\d)"})
self.locale_time = locale_time
--- 307,327 ----
def __init__(self, locale_time=LocaleTime()):
"""Init inst with non-locale regexes and store LocaleTime object."""
! #XXX: Does 'Y' need to worry about having less or more than 4 digits?
! base = super(TimeRE, self)
! base.__init__({
# The " \d" option is to make %c from ANSI C work
! 'd': r"(?P<d>3[0-1]|[1-2]\d|0[1-9]|[1-9]| [1-9])",
'H': r"(?P<H>2[0-3]|[0-1]\d|\d)",
! 'I': r"(?P<I>1[0-2]|0[1-9]|[1-9])",
! 'j': r"(?P<j>36[0-6]|3[0-5]\d|[1-2]\d\d|0[1-9]\d|00[1-9]|[1-9]\d|0[1-9]|[1-9])",
! 'm': r"(?P<m>1[0-2]|0[1-9]|[1-9])",
'M': r"(?P<M>[0-5]\d|\d)",
'S': r"(?P<S>6[0-1]|[0-5]\d|\d)",
'U': r"(?P<U>5[0-3]|[0-4]\d|\d)",
'w': r"(?P<w>[0-6])",
! # W is set below by using 'U'
'y': r"(?P<y>\d\d)",
'Y': r"(?P<Y>\d\d\d\d)"})
+ base.__setitem__('W', base.__getitem__('U'))
self.locale_time = locale_time
- Previous message: [Python-checkins] python/dist/src/Lib/plat-darwin IN.py,NONE,1.1 regen,NONE,1.1
- Next message: [Python-checkins] python/dist/src Makefile.pre.in,1.105,1.106 configure.in,1.380,1.381 configure,1.369,1.370
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]