[ python-Bugs-1488943 ] difflib.Differ() doesn't always add hints for tab characters

SourceForge.net noreply at sourceforge.net
Tue May 16 15:21:55 CEST 2006


Bugs item #1488943, was opened at 2006-05-16 00:27
Message generated for change (Comment added) made by henryl
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1488943&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Henry (henryl)
Assigned to: Nobody/Anonymous (nobody)
Summary: difflib.Differ() doesn't always add hints for tab characters

Initial Comment:
The difflib.Differ() object doesn't always add a hint
for added tab characters.

eg:
import difflib
differ = difflib.Differ()
for change in differ.compare(["\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
(Intel)]

----------------------------------------------------------------------

>Comment By: Henry (henryl)
Date: 2006-05-16 21:21

Message:
Logged In: YES 
user_id=1083163

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).

----------------------------------------------------------------------

Comment By: Henry (henryl)
Date: 2006-05-16 21:19

Message:
Logged In: YES 
user_id=1083163

Try again (this time selecting check box)...

----------------------------------------------------------------------

Comment By: Henry (henryl)
Date: 2006-05-16 21:18

Message:
Logged In: YES 
user_id=1083163

Patch to lib/test/test_difflib.py attached.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1488943&group_id=5470


More information about the Python-bugs-list mailing list