failure in test_sre???

Is it just me, or is test_sre meant to fail, following the recent changes to _sre.c? Short failure message: test test_sre failed -- Writing: 'sre.match("\\x%02x" % i, chr(i)) != None', expected: '' Full failure messages: Running tests on character literals sre.match("\x%02x" % i, chr(i)) != None FAILED Traceback (most recent call last): File "test_sre.py", line 18, in test r = eval(expression) ValueError: invalid \x escape sre.match("\x%02x0" % i, chr(i)+"0") != None FAILED Traceback (most recent call last): File "test_sre.py", line 18, in test r = eval(expression) ValueError: invalid \x escape sre.match("\x%02xz" % i, chr(i)+"z") != None FAILED Traceback (most recent call last): File "test_sre.py", line 18, in test r = eval(expression) ValueError: invalid \x escape (the above sequence is repeated another 7 times) -- Mark

[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?
Checkins are never supposed to leave the test suite in a failing state, but while that's "the rule" it's still too rarely the reality (although *much* better than it was just a month ago -- whining works <wink>). Offhand these look like shallow new failures to me, related to /F's so-far partial implemention of PEP 223 (Change the Meaning of \x Escapes). I'll dig into a little more. Rest assured it will get fixed before the 2.0b1 release!

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.

[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?
Checkins are never supposed to leave the test suite in a failing state, but while that's "the rule" it's still too rarely the reality (although *much* better than it was just a month ago -- whining works <wink>). Offhand these look like shallow new failures to me, related to /F's so-far partial implemention of PEP 223 (Change the Meaning of \x Escapes). I'll dig into a little more. Rest assured it will get fixed before the 2.0b1 release!

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.
participants (2)
-
Mark Favas
-
Tim Peters