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 scoder
Recipients benjamin.peterson, duaneg, eli.bendersky, lwcolton, piro, rhettinger, scoder
Date 2015-09-06.18:53:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1441565592.61.0.493148283995.issue17582@psf.upfronthosting.co.za>
In-reply-to
Content
Patch and test look correct. They fix a bug that produces incorrect output, so I vote for backporting them. Most code won't see the difference as whitespace control characters are rare in attribute values. And code that uses them will benefit from correctness. Obviously, there might also be breakage in the rare case that code puts control characters into attribute values and expects them to disappear magically, but then it's the user code that is wrong here.

Only issue is that serialisation is slow already and this change slows it down a bit more. Every attribute value will now be searched 8 times instead of 5 times. I added a minor review comment that would normally reduce it to 7. timeit suggests to me that the overall overhead is still tiny, though, and thus acceptable:

$ python3.5 -m timeit -s "s = 'askhfalsdhfashldfsadf'" "'\n' in s"
10000000 loops, best of 3: 0.0383 usec per loop

$ python3.5 -m timeit -s "s = 'askhfalsdhfashldfsadf'" "s.replace('\n', 'y')"
10000000 loops, best of 3: 0.151 usec per loop

$ python3.5 -m timeit -s "s = 'askhfalsdhfashldfsadf'; rep=s.replace" "rep('\n', 'y')"
10000000 loops, best of 3: 0.12 usec per loop
History
Date User Action Args
2015-09-06 18:53:12scodersetrecipients: + scoder, rhettinger, piro, benjamin.peterson, duaneg, eli.bendersky, lwcolton
2015-09-06 18:53:12scodersetmessageid: <1441565592.61.0.493148283995.issue17582@psf.upfronthosting.co.za>
2015-09-06 18:53:12scoderlinkissue17582 messages
2015-09-06 18:53:11scodercreate