Skip to content

Commit f3c99f7

Browse files
committed
Merge pull request #1 from ddohler/master
Disable automatic junk detection on Python >=2.7.1
2 parents 8421ee0 + 20e7c28 commit f3c99f7

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

diff.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/python2.2
1+
#!/usr/bin/python
22
"""HTML Diff: http://www.aaronsw.com/2002/diff
33
Rough code, badly documented. Send me comments and patches."""
44

@@ -15,7 +15,10 @@ def textDiff(a, b):
1515

1616
out = []
1717
a, b = html2list(a), html2list(b)
18-
s = difflib.SequenceMatcher(None, a, b)
18+
try: # autojunk can cause malformed HTML, but also speeds up processing.
19+
s = difflib.SequenceMatcher(None, a, b, autojunk=False)
20+
except TypeError:
21+
s = difflib.SequenceMatcher(None, a, b)
1922
for e in s.get_opcodes():
2023
if e[0] == "replace":
2124
# @@ need to do something more complicated here

0 commit comments

Comments
 (0)