This comes from diagnosing a beginner's question on Python-tutor.
https://mail.python.org/pipermail/tutor/2016-December/110066.html
It appears that re.sub is not checking whether the count argument is integer or not, and silently accepts a nonsensical argument. For example:
>>> import re
>>> s = "AAAcBBB\nAAAdBBB"
>>> print(re.sub(r'^AAA', "aaa", s, re.MULTILINE))
aaacBBB
AAAdBBB
Of course, the user intended to pass re.MULTILINE to flags, not to count, but the fact that this isn't raising a TypeError is error-prone.