[Python-checkins] python/dist/src/Modules pyexpat.c,2.81,2.82
Neal Norwitz
neal@metaslash.com
Mon, 21 Jul 2003 13:20:00 -0400
On Mon, Jul 21, 2003 at 10:05:58AM -0700, fdrake@users.sourceforge.net wrote:
>
> ***************
> *** 988,993 ****
> int bytes_read;
> void *buf = XML_GetBuffer(self->itself, BUF_SIZE);
> ! if (buf == NULL)
> return PyErr_NoMemory();
>
> if (fp) {
> --- 989,996 ----
> int bytes_read;
> void *buf = XML_GetBuffer(self->itself, BUF_SIZE);
> ! if (buf == NULL) {
> ! Py_DECREF(readmethod);
> return PyErr_NoMemory();
> + }
Doesn't that need to be Py_XDECREF(readmethod); instead of Py_DECREF()?
readmethod is NULL if a PyFileObject is passed in.
The other places below seem to handle this correctly.
> ***************
> *** 1000,1013 ****
> else {
> bytes_read = readinst(buf, BUF_SIZE, readmethod);
> ! if (bytes_read < 0)
> return NULL;
> }
> rv = XML_ParseBuffer(self->itself, bytes_read, bytes_read == 0);
> ! if (PyErr_Occurred())
> return NULL;
>
> if (!rv || bytes_read == 0)
> break;
> }
> return get_parse_result(self, rv);
> }
> --- 1003,1021 ----
> else {
> bytes_read = readinst(buf, BUF_SIZE, readmethod);
> ! if (bytes_read < 0) {
> ! Py_DECREF(readmethod);
> return NULL;
> + }
> }
> rv = XML_ParseBuffer(self->itself, bytes_read, bytes_read == 0);
> ! if (PyErr_Occurred()) {
> ! Py_XDECREF(readmethod);
> return NULL;
> + }
>
> if (!rv || bytes_read == 0)
> break;
> }
> + Py_XDECREF(readmethod);
> return get_parse_result(self, rv);
> }
>
>
>
> _______________________________________________
> Python-checkins mailing list
> Python-checkins@python.org
> http://mail.python.org/mailman/listinfo/python-checkins