[Patches] [ python-Patches-418615 ] regular expression bug in pipes.py.

noreply@sourceforge.net noreply@sourceforge.net
Tue, 24 Apr 2001 20:43:59 -0700


Patches item #418615, was updated on 2001-04-24 11:50
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=418615&group_id=5470

Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Jeffery D. Collins (tokeneater)
>Assigned to: Tim Peters (tim_one)
Summary: regular expression bug in pipes.py.

Initial Comment:
I tried running the test() function in pipes.py, but the following exception was raised:

>>> import pipes
>>> t = pipes.Template()
>>> t.append('x $IN $OUT', 'ff')
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/local/lib/python2.1/pipes.py", line 127, in append
    raise ValueError, ValueError: Template.append: missing $IN in cmd
>

After some experimenting, I discovered that the regular expression argument to re.search() contains the character '\b', which is interpreted by the string object as a backspace.  Those strings have now been changed to raw strings to avoid this problem.

I suppose that this module is not widely used.  This problem appears in versions as far back as 1.5.2.


----------------------------------------------------------------------

>Comment By: Tim Peters (tim_one)
Date: 2001-04-24 20:43

Message:
Logged In: YES 
user_id=31435

Thanks, Jeffery!  I found 4 calls of this form to re.search
(), and they are indeed clearly wrong.  Repaired as you 
suggested, in

Lib/pipes.py; new revision: 1.9


----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=418615&group_id=5470