Show More
@@ -1713,6 +1713,15 b' static int index_init(indexObject *self,' | |||
|
1713 | 1713 | PyObject *data_obj, *inlined_obj; |
|
1714 | 1714 | Py_ssize_t size; |
|
1715 | 1715 | |
|
1716 | /* Initialize before argument-checking to avoid index_dealloc() crash. */ | |
|
1717 | self->raw_length = 0; | |
|
1718 | self->added = NULL; | |
|
1719 | self->cache = NULL; | |
|
1720 | self->data = NULL; | |
|
1721 | self->headrevs = NULL; | |
|
1722 | self->nt = NULL; | |
|
1723 | self->offsets = NULL; | |
|
1724 | ||
|
1716 | 1725 | if (!PyArg_ParseTuple(args, "OO", &data_obj, &inlined_obj)) |
|
1717 | 1726 | return -1; |
|
1718 | 1727 | if (!PyString_Check(data_obj)) { |
@@ -1723,12 +1732,7 b' static int index_init(indexObject *self,' | |||
|
1723 | 1732 | |
|
1724 | 1733 | self->inlined = inlined_obj && PyObject_IsTrue(inlined_obj); |
|
1725 | 1734 | self->data = data_obj; |
|
1726 | self->cache = NULL; | |
|
1727 | 1735 | |
|
1728 | self->added = NULL; | |
|
1729 | self->headrevs = NULL; | |
|
1730 | self->offsets = NULL; | |
|
1731 | self->nt = NULL; | |
|
1732 | 1736 | self->ntlength = self->ntcapacity = 0; |
|
1733 | 1737 | self->ntdepth = self->ntsplits = 0; |
|
1734 | 1738 | self->ntlookups = self->ntmisses = 0; |
@@ -1764,7 +1768,7 b' static PyObject *index_nodemap(indexObje' | |||
|
1764 | 1768 | static void index_dealloc(indexObject *self) |
|
1765 | 1769 | { |
|
1766 | 1770 | _index_clearcaches(self); |
|
1767 | Py_DECREF(self->data); | |
|
1771 | Py_XDECREF(self->data); | |
|
1768 | 1772 | Py_XDECREF(self->added); |
|
1769 | 1773 | PyObject_Del(self); |
|
1770 | 1774 | } |
@@ -98,6 +98,14 b' def parse_index2(data, inline):' | |||
|
98 | 98 | return list(index), chunkcache |
|
99 | 99 | |
|
100 | 100 | def runtest() : |
|
101 | # Check that parse_index2() raises TypeError on bad arguments. | |
|
102 | try: | |
|
103 | parse_index2(0, True) | |
|
104 | except TypeError: | |
|
105 | pass | |
|
106 | else: | |
|
107 | print "Expected to get TypeError." | |
|
108 | ||
|
101 | 109 | py_res_1 = py_parseindex(data_inlined, True) |
|
102 | 110 | c_res_1 = parse_index2(data_inlined, True) |
|
103 | 111 |
General Comments 0
You need to be logged in to leave comments.
Login now