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.
This commit is contained in:
parent
1660e0c1f1
commit
0f5bf1ebdd
|
@ -215,7 +215,8 @@ def _join(seq, sep):
|
||||||
|
|
||||||
def _compile(*key):
|
def _compile(*key):
|
||||||
# internal: compile pattern
|
# internal: compile pattern
|
||||||
p = _cache.get(key)
|
cachekey = (type(key[0]),) + key
|
||||||
|
p = _cache.get(cachekey)
|
||||||
if p is not None:
|
if p is not None:
|
||||||
return p
|
return p
|
||||||
pattern, flags = key
|
pattern, flags = key
|
||||||
|
@ -229,7 +230,7 @@ def _compile(*key):
|
||||||
raise error, v # invalid expression
|
raise error, v # invalid expression
|
||||||
if len(_cache) >= _MAXCACHE:
|
if len(_cache) >= _MAXCACHE:
|
||||||
_cache.clear()
|
_cache.clear()
|
||||||
_cache[key] = p
|
_cache[cachekey] = p
|
||||||
return p
|
return p
|
||||||
|
|
||||||
def _compile_repl(*key):
|
def _compile_repl(*key):
|
||||||
|
|
|
@ -303,6 +303,10 @@ Extension modules
|
||||||
Library
|
Library
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
- Bug #926075: Fixed a 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.
|
||||||
|
|
||||||
- Added countcallers arg to trace.Trace class (--trackcalls command line arg
|
- Added countcallers arg to trace.Trace class (--trackcalls command line arg
|
||||||
when run from the command prompt).
|
when run from the command prompt).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue