Message 281496 - Python tracker (original) (raw)
On Nov 22, 2016, at 04:13 PM, Serhiy Storchaka wrote:
Could Mailman be fixed? Undefined combinations of \ + ASCII emitted warnings in 3.5. And now they emit warnings even just in string literals (). If Mailman use undefined escape combinations, it could suffer from too.
No, I think this is a valid bug/regression.
The Mailman code is basically trying to do this:
p = re.compile('%\d*d')
p.sub(r'\s*\d+\s*', some_string)
And so we get the error:
sre_constants.error: bad escape \s at position 0
But this directly contradicts the documentation for re.sub():
"... if it is a string, any backslash escapes in it are processed. That is, \n is converted to a single newline character, \r is converted to a carriage return, and so forth. Unknown escapes such as & are left alone."
Clearly \s is not being left alone, so this is a real regression.