[Python-checkins] python/dist/src/Lib sre.py,1.47,1.47.6.1

perky at users.sourceforge.net perky at users.sourceforge.net
Tue Apr 20 17:16:27 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26270/Lib

Modified Files:
      Tag: release23-maint
	sre.py 
Log Message:
SF #926075: Fixed the bug that returns a wrong pattern object for
a string or unicode object in sre.compile() when a different type
pattern with the same value exists.


Index: sre.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/sre.py,v
retrieving revision 1.47
retrieving revision 1.47.6.1
diff -C2 -d -r1.47 -r1.47.6.1
*** sre.py	2 Jul 2003 21:37:16 -0000	1.47
--- sre.py	20 Apr 2004 21:16:06 -0000	1.47.6.1
***************
*** 216,220 ****
  def _compile(*key):
      # internal: compile pattern
!     p = _cache.get(key)
      if p is not None:
          return p
--- 216,221 ----
  def _compile(*key):
      # internal: compile pattern
!     cachekey = (type(key[0]),) + key
!     p = _cache.get(cachekey)
      if p is not None:
          return p
***************
*** 230,234 ****
      if len(_cache) >= _MAXCACHE:
          _cache.clear()
!     _cache[key] = p
      return p
  
--- 231,235 ----
      if len(_cache) >= _MAXCACHE:
          _cache.clear()
!     _cache[cachekey] = p
      return p
  




More information about the Python-checkins mailing list