Merge pull request #6 from nnako/master

FIX: enable error-free string output for Python v2 and v3
This commit is contained in:
Alex Goodman 2018-04-21 20:33:56 -04:00 committed by GitHub
commit b151d377b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -238,7 +238,12 @@ class DiffHtmlFormatter(HtmlFormatter):
for t, line in inner:
if t:
lncount += 1
dummyoutfile.write(unicode(line))
# compatibility Python v2/v3
if sys.version_info > (3,0):
dummyoutfile.write(line)
else:
dummyoutfile.write(unicode(line))
fl = self.linenostart
mw = len(str(lncount + fl - 1))