From dc6946e72eb69e67d1e00f741f5ba595fa740a18 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 9 Oct 2009 11:57:46 +0300 Subject: [PATCH] Revert explicit PyErr_NoMemory() returns to just returning NULL - tp_alloc failing is likely to be OOM but we dont know that for a fact, and the failing method is responsible for setting the exception --- python/header-py.c | 2 +- python/rpmds-py.c | 2 +- python/rpmfi-py.c | 2 +- python/rpmkeyring-py.c | 4 ++-- python/rpmmi-py.c | 2 +- python/rpmps-py.c | 4 ++-- python/rpmtd-py.c | 2 +- python/rpmte-py.c | 2 +- python/rpmts-py.c | 2 +- python/spec-py.c | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/python/header-py.c b/python/header-py.c index 293c9e7da..d2901220c 100644 --- a/python/header-py.c +++ b/python/header-py.c @@ -530,7 +530,7 @@ PyTypeObject hdr_Type = { PyObject * hdr_Wrap(PyTypeObject *subtype, Header h) { hdrObject * hdr = (hdrObject *)subtype->tp_alloc(subtype, 0); - if (hdr == NULL) return PyErr_NoMemory(); + if (hdr == NULL) return NULL; hdr->h = headerLink(h); return (PyObject *) hdr; diff --git a/python/rpmds-py.c b/python/rpmds-py.c index ebbf82ef8..71ef93fde 100644 --- a/python/rpmds-py.c +++ b/python/rpmds-py.c @@ -508,7 +508,7 @@ rpmds dsFromDs(rpmdsObject * s) PyObject * rpmds_Wrap(PyTypeObject *subtype, rpmds ds) { rpmdsObject * s = (rpmdsObject *)subtype->tp_alloc(subtype, 0); - if (s == NULL) return PyErr_NoMemory(); + if (s == NULL) return NULL; s->ds = ds; s->active = 0; diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c index 6f0e162ff..5894ef4f2 100644 --- a/python/rpmfi-py.c +++ b/python/rpmfi-py.c @@ -370,7 +370,7 @@ rpmfi fiFromFi(rpmfiObject * s) PyObject * rpmfi_Wrap(PyTypeObject *subtype, rpmfi fi) { rpmfiObject *s = (rpmfiObject *)subtype->tp_alloc(subtype, 0); - if (s == NULL) return PyErr_NoMemory(); + if (s == NULL) return NULL; s->fi = fi; s->active = 0; diff --git a/python/rpmkeyring-py.c b/python/rpmkeyring-py.c index 9fa4f4880..7b57fdbea 100644 --- a/python/rpmkeyring-py.c +++ b/python/rpmkeyring-py.c @@ -179,7 +179,7 @@ PyTypeObject rpmKeyring_Type = { PyObject * rpmPubkey_Wrap(PyTypeObject *subtype, rpmPubkey pubkey) { rpmPubkeyObject *s = (rpmPubkeyObject *)subtype->tp_alloc(subtype, 0); - if (s == NULL) return PyErr_NoMemory(); + if (s == NULL) return NULL; s->pubkey = pubkey; return (PyObject*) s; @@ -188,7 +188,7 @@ PyObject * rpmPubkey_Wrap(PyTypeObject *subtype, rpmPubkey pubkey) PyObject * rpmKeyring_Wrap(PyTypeObject *subtype, rpmKeyring keyring) { rpmKeyringObject *s = (rpmKeyringObject *)subtype->tp_alloc(subtype, 0); - if (s == NULL) return PyErr_NoMemory(); + if (s == NULL) return NULL; s->keyring = keyring; return (PyObject*) s; diff --git a/python/rpmmi-py.c b/python/rpmmi-py.c index 1d06b5ed9..b3cd6d2ab 100644 --- a/python/rpmmi-py.c +++ b/python/rpmmi-py.c @@ -192,7 +192,7 @@ PyTypeObject rpmmi_Type = { PyObject * rpmmi_Wrap(PyTypeObject *subtype, rpmdbMatchIterator mi, PyObject *s) { rpmmiObject * mio = (rpmmiObject *)subtype->tp_alloc(subtype, 0); - if (mio == NULL) return PyErr_NoMemory(); + if (mio == NULL) return NULL; mio->mi = mi; mio->ref = s; diff --git a/python/rpmps-py.c b/python/rpmps-py.c index 2f815488f..dae50e64d 100644 --- a/python/rpmps-py.c +++ b/python/rpmps-py.c @@ -121,7 +121,7 @@ PyTypeObject rpmProblem_Type = { static PyObject *rpmprob_Wrap(PyTypeObject *subtype, rpmProblem prob) { rpmProblemObject * s = (rpmProblemObject *)subtype->tp_alloc(subtype, 0); - if (s == NULL) return PyErr_NoMemory(); + if (s == NULL) return NULL; s->prob = prob; return (PyObject *) s; @@ -282,7 +282,7 @@ rpmps psFromPs(rpmpsObject * s) PyObject * rpmps_Wrap(PyTypeObject *subtype, rpmps ps) { rpmpsObject * s = (rpmpsObject *)subtype->tp_alloc(subtype, 0); - if (s == NULL) return PyErr_NoMemory(); + if (s == NULL) return NULL; s->ps = ps; /* XXX refcounts? */ s->psi = NULL; diff --git a/python/rpmtd-py.c b/python/rpmtd-py.c index 1b55e0c5f..103910aef 100644 --- a/python/rpmtd-py.c +++ b/python/rpmtd-py.c @@ -107,7 +107,7 @@ static PyObject *rpmtd_new(PyTypeObject * subtype, PyObject *args, PyObject *kwd if (noext) flags &= ~HEADERGET_EXT; if ((s = (rpmtdObject *)subtype->tp_alloc(subtype, 0)) == NULL) - return PyErr_NoMemory(); + return NULL; headerGet(h, tag, &(s->td), flags); diff --git a/python/rpmte-py.c b/python/rpmte-py.c index 691eae88e..3a5957893 100644 --- a/python/rpmte-py.c +++ b/python/rpmte-py.c @@ -312,7 +312,7 @@ PyTypeObject rpmte_Type = { PyObject * rpmte_Wrap(PyTypeObject *subtype, rpmte te) { rpmteObject *s = (rpmteObject *)subtype->tp_alloc(subtype, 0); - if (s == NULL) return PyErr_NoMemory(); + if (s == NULL) return NULL; s->te = te; return (PyObject *) s; diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 04dd78381..c59008ebd 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -848,7 +848,7 @@ PyTypeObject rpmts_Type = { PyObject * rpmts_Wrap(PyTypeObject *subtype, rpmts ts) { rpmtsObject * s = (rpmtsObject *)subtype->tp_alloc(subtype, 0); - if (s == NULL) return PyErr_NoMemory(); + if (s == NULL) return NULL; s->ts = ts; s->scriptFd = NULL; diff --git a/python/spec-py.c b/python/spec-py.c index 6b89d9738..409db0d8c 100644 --- a/python/spec-py.c +++ b/python/spec-py.c @@ -228,7 +228,7 @@ PyObject * spec_Wrap(PyTypeObject *subtype, rpmSpec spec) { specObject * s = (specObject *)subtype->tp_alloc(subtype, 0); - if (s == NULL) return PyErr_NoMemory(); + if (s == NULL) return NULL; s->spec = spec; return (PyObject *) s;