[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Lib sre.py,1.9,1.10 sre_compile.py,1.7,1.8 sre_constants.py,1.7,1.8 sre_parse.py,1.7,1.8

Greg Stein gstein@lyra.org
Thu, 29 Jun 2000 18:03:11 -0700


Fredrik,

Something you are doing is forcing CVS to issue a new revision for some of
those files, even when you are not changing them. These "false" revisions
are probably not a good thing.

Could you review your checkin process to see what is up? I would guess that
you have the "-f" option in your commit line.

Cheers,
-g

On Thu, Jun 29, 2000 at 05:38:48AM -0700, Fredrik Lundh wrote:
> Update of /cvsroot/python/python/dist/src/Lib
> In directory slayer.i.sourceforge.net:/tmp/cvs-serv899/Lib
> 
> Modified Files:
> 	sre.py sre_compile.py sre_constants.py sre_parse.py 
> Log Message:
> 
> 
> - make sure group names are valid identifiers
>   (closes the "SRE: symbolic reference" bug)
> 
> Index: sre.py
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Lib/sre.py,v
> retrieving revision 1.9
> retrieving revision 1.10
> diff -C2 -r1.9 -r1.10
> 
> Index: sre_compile.py
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Lib/sre_compile.py,v
> retrieving revision 1.7
> retrieving revision 1.8
> diff -C2 -r1.7 -r1.8
> 
> Index: sre_constants.py
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Lib/sre_constants.py,v
> retrieving revision 1.7
> retrieving revision 1.8
> diff -C2 -r1.7 -r1.8
> 
> Index: sre_parse.py
> ===================================================================
> RCS file: /cvsroot/python/python/dist/src/Lib/sre_parse.py,v
> retrieving revision 1.7
> retrieving revision 1.8
> diff -C2 -r1.7 -r1.8
> *** sre_parse.py	2000/06/29 11:34:27	1.7
> --- sre_parse.py	2000/06/29 12:38:45	1.8
> ***************
> *** 169,172 ****
> --- 169,190 ----
>   	return this
>   
> + def isident(char):
> +     return "a" <= char <= "z" or "A" <= char <= "Z" or char == "_"
> + 
> + def isdigit(char):
> +     return "0" <= char <= "9"
> + 
> + def isname(name):
> +     # check that group name is a valid string
> +     # FIXME: <fl> this code is really lame.  should use a regular
> +     # expression instead, but I seem to have certain bootstrapping
> +     # problems here ;-)
> +     if not isident(name[0]):
> + 	return 0
> +     for char in name:
> + 	if not isident(char) and not isdigit(char):
> + 	    return 0
> +     return 1
> + 
>   def _group(escape, state):
>       # check if the escape string represents a valid group
> ***************
> *** 419,425 ****
>   			    if char == ">":
>   				break
> - 			    # FIXME: check for valid character
>   			    name = name + char
>   			group = 1
>   		    elif source.match("="):
>   			# named backreference
> --- 437,444 ----
>   			    if char == ">":
>   				break
>   			    name = name + char
>   			group = 1
> + 			if not isname(name):
> + 			    raise error, "illegal character in group name"
>   		    elif source.match("="):
>   			# named backreference
> ***************
> *** 523,540 ****
>   			char = s.get()
>   			if char is None:
> ! 			    raise error, "unterminated index"
>   			if char == ">":
>   			    break
> - 			# FIXME: check for valid character
>   			name = name + char
>   		if not name:
> ! 		    raise error, "bad index"
>   		try:
>   		    index = int(name)
>   		except ValueError:
>   		    try:
>   			index = pattern.groupindex[name]
>   		    except KeyError:
> ! 			raise IndexError, "unknown index"
>   		a((MARK, index))
>   	    elif len(this) > 1 and this[1] in DIGITS:
> --- 542,560 ----
>   			char = s.get()
>   			if char is None:
> ! 			    raise error, "unterminated group name"
>   			if char == ">":
>   			    break
>   			name = name + char
>   		if not name:
> ! 		    raise error, "bad group name"
>   		try:
>   		    index = int(name)
>   		except ValueError:
> + 		    if not isname(name):
> + 			raise error, "illegal character in group name"
>   		    try:
>   			index = pattern.groupindex[name]
>   		    except KeyError:
> ! 			raise IndexError, "unknown group name"
>   		a((MARK, index))
>   	    elif len(this) > 1 and this[1] in DIGITS:
> 
> 
> _______________________________________________
> Python-checkins mailing list
> Python-checkins@python.org
> http://www.python.org/mailman/listinfo/python-checkins

-- 
Greg Stein, http://www.lyra.org/