[Python-checkins] python/dist/src/Lib pre.py,1.12,1.13

effbot@users.sourceforge.net effbot@users.sourceforge.net
Thu, 27 Jun 2002 12:59:30 -0700


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

Modified Files:
	pre.py 
Log Message:


Fix bug #570057: Broken pre.subn() (and pre.sub())

This should be backported to the 2.2.X series (how
do I do that?)


Index: pre.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pre.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** pre.py	16 Apr 2002 01:38:39 -0000	1.12
--- pre.py	27 Jun 2002 19:59:27 -0000	1.13
***************
*** 368,375 ****
  
          if type(repl) is type(''):
!             # See if repl contains group references
              try:
                  repl = pcre_expand(_Dummy, repl)
!             except error:
                  m = MatchObject(self, source, 0, end, [])
                  repl = lambda m, repl=repl, expand=pcre_expand: expand(m, repl)
--- 368,377 ----
  
          if type(repl) is type(''):
!             # See if repl contains group references (if it does,
!             # pcre_expand will attempt to call _Dummy.group, which
!             # results in a TypeError)
              try:
                  repl = pcre_expand(_Dummy, repl)
!             except (error, TypeError):
                  m = MatchObject(self, source, 0, end, [])
                  repl = lambda m, repl=repl, expand=pcre_expand: expand(m, repl)