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

perky at users.sourceforge.net perky at users.sourceforge.net
Tue Apr 20 17:11:32 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24492/Lib
Modified Files:
	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.48
diff -C2 -d -r1.47 -r1.48
*** sre.py	2 Jul 2003 21:37:16 -0000	1.47
--- sre.py	20 Apr 2004 21:11:11 -0000	1.48
***************
*** 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

AltStyle によって変換されたページ (->オリジナル) /