Mercurial > hg
comparison mercurial/parsers.c @ 31426:43a7dfbead0c
parsers: handle refcounting of "parents" consistently
Py_None can be refcounted like any other Python object. So
do that.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 13 Mar 2017 17:49:13 -0700 |
parents | b6ab0adf379d |
children | a43fd9ec2a39 |
comparison
equal
deleted
inserted
replaced
31425:63a39d647888 | 31426:43a7dfbead0c |
---|---|
2737 goto bail; | 2737 goto bail; |
2738 } | 2738 } |
2739 data += nparents * hashwidth; | 2739 data += nparents * hashwidth; |
2740 } else { | 2740 } else { |
2741 parents = Py_None; | 2741 parents = Py_None; |
2742 Py_INCREF(parents); | |
2742 } | 2743 } |
2743 | 2744 |
2744 if (data + 2 * nmetadata > dataend) { | 2745 if (data + 2 * nmetadata > dataend) { |
2745 goto overflow; | 2746 goto overflow; |
2746 } | 2747 } |
2779 PyErr_SetString(PyExc_ValueError, "overflow in obsstore"); | 2780 PyErr_SetString(PyExc_ValueError, "overflow in obsstore"); |
2780 bail: | 2781 bail: |
2781 Py_XDECREF(prec); | 2782 Py_XDECREF(prec); |
2782 Py_XDECREF(succs); | 2783 Py_XDECREF(succs); |
2783 Py_XDECREF(metadata); | 2784 Py_XDECREF(metadata); |
2784 if (parents != Py_None) | 2785 Py_XDECREF(parents); |
2785 Py_XDECREF(parents); | |
2786 return ret; | 2786 return ret; |
2787 } | 2787 } |
2788 | 2788 |
2789 | 2789 |
2790 static PyObject *fm1readmarkers(PyObject *self, PyObject *args) { | 2790 static PyObject *fm1readmarkers(PyObject *self, PyObject *args) { |