[Python-checkins] python/dist/src/Lib _strptime.py,1.22,1.23

bcannon@users.sourceforge.net bcannon@users.sourceforge.net
Thu, 24 Jul 2003 13:02:31 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv16679/Lib

Modified Files:
	_strptime.py 
Log Message:
Fixes bug of having default argument for TimeRE's __init__ that caused the
LocaleTime instance to only be created once and thus not be recreated when
the locale changed.


Index: _strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/_strptime.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** _strptime.py	24 Jul 2003 06:27:17 -0000	1.22
--- _strptime.py	24 Jul 2003 20:02:28 -0000	1.23
***************
*** 293,297 ****
      """Handle conversion from format directives to regexes."""
  
!     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?
--- 293,297 ----
      """Handle conversion from format directives to regexes."""
  
!     def __init__(self, locale_time=None):
          """Init inst with non-locale regexes and store LocaleTime object."""
          #XXX: Does 'Y' need to worry about having less or more than 4 digits?
***************
*** 312,316 ****
              'Y': r"(?P<Y>\d\d\d\d)"})
          base.__setitem__('W', base.__getitem__('U'))
!         self.locale_time = locale_time
  
      def __getitem__(self, fetch):
--- 312,319 ----
              'Y': r"(?P<Y>\d\d\d\d)"})
          base.__setitem__('W', base.__getitem__('U'))
!         if locale_time:
!             self.locale_time = locale_time
!         else:
!             self.locale_time = LocaleTime()
  
      def __getitem__(self, fetch):