docutils/utils/smartquotes.py
contains the following statement:
text = re.sub(r"""'(?=\d{2}s)""", smart.apostrophe, text, re.UNICODE)
But the 4th argument to re.sub()
is supposed to be maximum number of substitutions, not flags.
This bug was found using pydiatra.
Fixed in commit 8209.
Thank you for the report
I forgot to mention that in Python 2.6 (which Docutils is supposed to support),
re.sub()
doesn't accept flags argument at all. You would have to compile the regexp beforhand, or use inline flags.You are right, I missed this point.
As the Unicode flag is not required in this specific expression, I removed it to restore 2.6 compatibility.
Thank you for reporting.