~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/_knit_load_data_c.pyx

  • Committer: John Arbash Meinel
  • Date: 2007-06-29 00:31:00 UTC
  • mto: This revision was merged to the branch mainline in revision 2614.
  • Revision ID: john@arbash-meinel.com-20070629003100-xthewxf3hpdes9ix
Add a test that KnitCorrupt is raised when parent strings are invalid.
And fix *both* implementations so that they do the right thing.

Show diffs side-by-side

added added

removed removed

Lines of Context:
126
126
            next_option = PyString_FromStringAndSize(option_str,
127
127
                                                     next - option_str)
128
128
            PyList_Append(final_options, next_option)
129
 
                          
 
129
 
130
130
            # Move past the ','
131
131
            option_str = next+1
132
132
 
176
176
                    raise IndexError('Parent index refers to a revision which'
177
177
                        ' does not exist yet.'
178
178
                        ' %d > %d' % (int_parent, self.history_len))
179
 
                if end < next-1:
 
179
                if parent_end < next:
180
180
                    # We didn't process all of the string, which means it isn't
181
181
                    # a complete integer.
182
182
                    py_parent = PyString_FromStringAndSize(parent_str,
245
245
        except (ValueError, IndexError), e:
246
246
            py_line = PyString_FromStringAndSize(start, end - start)
247
247
            raise errors.KnitCorrupt(self.kndx._filename,
248
 
                "line %r: %s" % (py_line, e))
 
248
                                     "line %r: %s" % (py_line, e))
249
249
 
250
250
        cache_entry = PyDict_GetItem_void(self.cache, version_id)
251
251
        if cache_entry == NULL: