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.

classification
Title: difflib.HtmlDiff produces different output from difflib.ndiff
Type: behavior Stage: needs patch
Components: Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: SilentGhost, eli.bendersky, jlwing, loewis, terry.reedy, xtreak
Priority: normal Keywords: patch

Created on 2016-08-08 15:40 by SilentGhost, last changed 2022-04-11 14:58 by admin.

Messages (2)
msg272173 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2016-08-08 15:40
msg264842 in issue26945 reports an odd results of HtmlDiff.make_file, digging into it I've noticed couple of things: different output to one generated directly from difflib.ndiff and underlying issue further up the stack that generates same faulty output with a slightly modified files.

The patch I'm attaching fixes the issue with different outputs, from make_file and ndiff, by not removing EOL characters, I had to re-generate expected test output file.
msg272196 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2016-08-08 21:47
The degenerate behaviour appears ultimately due to the autojunk heuristic. Given that autojunk defaults to True and there isn't any way to change via most user-facing functions, I don't think there is an easy resolution that can be found here. I'm going to withdraw the earlier patch, since it feels like a half-measure which enable correct behaviour by accident.
History
Date User Action Args
2022-04-11 14:58:34adminsetgithub: 71896
2018-09-22 18:00:18xtreaksetnosy: + xtreak
2016-08-08 21:47:15SilentGhostsetfiles: - donttrim.diff
2016-08-08 21:47:07SilentGhostsetnosy: + terry.reedy, eli.bendersky

messages: + msg272196
stage: patch review -> needs patch
2016-08-08 15:40:57SilentGhostcreate