python 2.3 difflib.py exception with empty file

Erik Toubro Nielsen erik at tntech.dk
Sun Mar 27 20:46:45 BST 2005


When using python-2.3.4 (python-2.3.4-3.2.rpm on SuSE9.2) and doing:
   mkdir d.test-empty
   cd d.test-empty
   bzr init
   touch empty.txt
   bzr add empty.txt
   bzr diff
This exception happens:
   bzr: exception: list index out of range
       see .bzr.log for details
   Traceback (most recent call last):
     File "/home/erik/work/mybazaar/bzrlib/commands.py", line 773, in main
       ret = run_bzr(argv)
     File "/home/erik/work/mybazaar/bzrlib/commands.py", line 759, in run_bzr
       ret = cmd_handler(**cmdargs) or 0
     File "/home/erik/work/mybazaar/bzrlib/commands.py", line 310, in cmd_diff
       tofile=new_label + new_name + idlabel)
     File "/home/erik/work/mybazaar/bzrlib/commands.py", line 298, in diffit
       sys.stdout.writelines(difflib.unified_diff(*a, **kw))
     File "/usr/lib/python2.3/difflib.py", line 1149, in unified_diff
       for group in SequenceMatcher(None,a,b).get_grouped_opcodes(n):
     File "/usr/lib/python2.3/difflib.py", line 574, in get_grouped_opcodes
       if codes[0][0] == 'equal':
   IndexError: list index out of range

Copying difflib.py from Python-2.4.1c2/Lib into bzrlib/ fixes the
problem (which, btw, is reported in:
<URL:http://mail.python.org/pipermail/python-bugs-list/2004-June/023770.html>)





More information about the bazaar mailing list