Skip to content

Unchanged lines detected as changes with difflib.HtmlDiff #137548

@jeffkaufman

Description

@jeffkaufman

Bug report

Bug description:

When running HtmlDiff on test_api_result.response.txt test_api_result.expected.txt (reported at jeffkaufman/icdiff#223) unchanged lines are being detected as changes. Here's the setup:

import difflib
a = open("test_api_result.response.txt").readlines()
b = open("test_api_result.expected.txt").readlines()
with open("tmp.html", "w") as outf:
    outf.write(difflib.HtmlDiff().make_file(a,b))

And the results: https://www.jefftk.com/html-diff-output-repro

I don't see these spurious deltas when running diff:

$ diff test_api_result.*
31,32c31,32
<             'latitude': 1,
<             'longitude': 1,
---
>             'latitude': 1.0,
>             'longitude': 1.0,
40c40
<         'meeting_url': '',
---
>         'meeting_url': None,
77,78c77,78
<             'latitude': 1,
<             'longitude': 1,
---
>             'latitude': 1.0,
>             'longitude': 1.0,
86c86
<         'meeting_url': '',
---
>         'meeting_url': None,
...

CPython versions tested on:

3.13

Operating systems tested on:

macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions