Title: difflib.Differ() doesn't always add hints for tab characters
Type: behavior Stage: patch review
Components: Library (Lib) Versions: Python 3.0, Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: henryl, orsenthil, sshock
Priority: normal Keywords: patch

Created on 2006-05-15 16:27 by henryl, last changed 2009-11-23 19:07 by orsenthil. This issue is now closed.

File name Uploaded Description Edit
test.patch henryl, 2006-05-16 13:19 Patch to lib/test/
difflib_fix.patch henryl, 2006-05-16 13:21 Fix tab hinting for difflib.Differ
Messages (8)
msg28539 - (view) Author: Henry (henryl) Date: 2006-05-15 16:27
The difflib.Differ() object doesn't always add a hint
for added tab characters.

import difflib
differ = difflib.Differ()
for change in["\tI am a buggy"],
["\t\tI am a bug"]):
	print repr(change)

Should return

'- \tI am a buggy'
'? \t          --\n'
'+ \t\tI am a bug'
'? +\n'

but actually returns (no hint for the added tab)

'- \tI am a buggy'
'? \t          --\n'
'+ \t\tI am a bug'

sys.version reports
2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit
msg28540 - (view) Author: Henry (henryl) Date: 2006-05-16 13:18
Logged In: YES 

Patch to lib/test/ attached.
msg28541 - (view) Author: Henry (henryl) Date: 2006-05-16 13:19
Logged In: YES 

Try again (this time selecting check box)...
msg28542 - (view) Author: Henry (henryl) Date: 2006-05-16 13:21
Logged In: YES 

Fix attached. Note that this also modifies the doctest for
Differ._qformat, as the doctest version actually exhibited
the bug (the added tab character wasn't hinted).
msg95466 - (view) Author: Phillip Hellewell (sshock) Date: 2009-11-19 08:31
Please apply the patch ASAP.  This bug is affecting downstream product
viewvc in a very adverse way.  See

It's sad that I spent several hours tracking down this bug only to find
out that henryl found it and provided a fix *3 and a half years ago*. 
Why is it taking so long to apply such a small yet important patch?
msg95642 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-11-23 18:42
Yes, I noticed the issue and found the patch to be good as well.
Unfortunate it was pending for a long time.
Fixed and Committed revision 76464 (trunk).
msg95645 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-11-23 18:56
merged to 26-maint in revision 76468 and shall merge in py3k too.
msg95646 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2009-11-23 19:07
fixed r76469 (py3k) and r76470(release31-maint). Closing the issue.
Date User Action Args
2009-11-23 19:07:06orsenthilsetstatus: open -> closed

messages: + msg95646
2009-11-23 18:56:29orsenthilsetmessages: + msg95645
2009-11-23 18:42:32orsenthilsetnosy: + orsenthil
messages: + msg95642

assignee: orsenthil
resolution: fixed
2009-11-19 08:31:53sshocksetnosy: + sshock
messages: + msg95466
2009-03-21 02:45:38ajaksu2setkeywords: + patch
stage: patch review
type: behavior
versions: + Python 2.6, Python 3.0, - Python 2.4
2006-05-15 16:27:37henrylcreate