[Python-Dev] failure in test_sre???

Tim Peters tim_one@email.msn.com
Sun, 3 Sep 2000 04:25:38 -0400


> [Mark Favas, on new test_sre failures]
> > Is it just me, or is test_sre meant to fail, following the recent
> > changes to _sre.c?

I just checked in a fix for this.  /F also implemented PEP 223, and it had a
surprising consequece for test_sre!  There were three test lines (in a loop,
that's why you got so many failures) of the form:

    test(r"""sre.match("\x%02x" % i, chr(i)) != None""", 1)

Note the

    "\x%02x"

part.  Before PEP 223, that "expanded" to itself:

    "\x%02x"

because the damaged \x escape was ignored.  After PEP223, it raised the

    ValueError: invalid \x escape

you kept seeing.  The fix was merely to change these 3 lines to use, e.g.,

    r"\x%02x"

instead.  Pattern strings should usually be r-strings anyway.