summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2007-03-08 21:30:55 +0000
committerRaymond Hettinger <python@rcn.com>2007-03-08 21:30:55 +0000
commit1622d82c08d0978cc1f19e340370030b8f424a37 (patch)
treee81441db9af561f387be29bb8c7c4d5b981208d4
parent590af0a7c9b151e3d72ef7f5e436f7d55c8611d9 (diff)
downloadcpython-git-1622d82c08d0978cc1f19e340370030b8f424a37.tar.gz
SF #1637850: make_table in difflib did not work with unicode
-rw-r--r--Lib/difflib.py9
-rw-r--r--Misc/NEWS2
2 files changed, 6 insertions, 5 deletions
diff --git a/Lib/difflib.py b/Lib/difflib.py
index d1c29318a6..9be6ca7242 100644
--- a/Lib/difflib.py
+++ b/Lib/difflib.py
@@ -1945,8 +1945,7 @@ class HtmlDiff(object):
fromlist,tolist,flaglist,next_href,next_id = self._convert_flags(
fromlist,tolist,flaglist,context,numlines)
- import cStringIO
- s = cStringIO.StringIO()
+ s = []
fmt = ' <tr><td class="diff_next"%s>%s</td>%s' + \
'<td class="diff_next">%s</td>%s</tr>\n'
for i in range(len(flaglist)):
@@ -1954,9 +1953,9 @@ class HtmlDiff(object):
# mdiff yields None on separator lines skip the bogus ones
# generated for the first line
if i > 0:
- s.write(' </tbody> \n <tbody>\n')
+ s.append(' </tbody> \n <tbody>\n')
else:
- s.write( fmt % (next_id[i],next_href[i],fromlist[i],
+ s.append( fmt % (next_id[i],next_href[i],fromlist[i],
next_href[i],tolist[i]))
if fromdesc or todesc:
header_row = '<thead><tr>%s%s%s%s</tr></thead>' % (
@@ -1968,7 +1967,7 @@ class HtmlDiff(object):
header_row = ''
table = self._table_template % dict(
- data_rows=s.getvalue(),
+ data_rows=''.join(s),
header_row=header_row,
prefix=self._prefix[1])
diff --git a/Misc/NEWS b/Misc/NEWS
index 4eb4020be9..1ea491600b 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -197,6 +197,8 @@ Extension Modules
Library
-------
+- Bug #1637850: make_table in difflib did not work with unicode
+
- Bugs #1676321: the empty() function in sched.py returned the wrong result
- unittest now verifies more of its assumptions. In particular, TestCase