This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Danny Yoo
Recipients Danny Yoo
Date 2016-12-08.17:02:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1481216578.4.0.700543113224.issue28905@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2016-12-08 17:02:58Danny Yoosetrecipients: + Danny Yoo
2016-12-08 17:02:58Danny Yoosetmessageid: <1481216578.4.0.700543113224.issue28905@psf.upfronthosting.co.za>
2016-12-08 17:02:58Danny Yoolinkissue28905 messages
2016-12-08 17:02:58Danny Yoocreate