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
This commit is contained in:
Panu Matilainen 2009-10-09 11:57:46 +03:00
parent 4e5132e443
commit dc6946e72e
10 changed files with 12 additions and 12 deletions

View File

@ -530,7 +530,7 @@ PyTypeObject hdr_Type = {
PyObject * hdr_Wrap(PyTypeObject *subtype, Header h) PyObject * hdr_Wrap(PyTypeObject *subtype, Header h)
{ {
hdrObject * hdr = (hdrObject *)subtype->tp_alloc(subtype, 0); hdrObject * hdr = (hdrObject *)subtype->tp_alloc(subtype, 0);
if (hdr == NULL) return PyErr_NoMemory(); if (hdr == NULL) return NULL;
hdr->h = headerLink(h); hdr->h = headerLink(h);
return (PyObject *) hdr; return (PyObject *) hdr;

View File

@ -508,7 +508,7 @@ rpmds dsFromDs(rpmdsObject * s)
PyObject * rpmds_Wrap(PyTypeObject *subtype, rpmds ds) PyObject * rpmds_Wrap(PyTypeObject *subtype, rpmds ds)
{ {
rpmdsObject * s = (rpmdsObject *)subtype->tp_alloc(subtype, 0); rpmdsObject * s = (rpmdsObject *)subtype->tp_alloc(subtype, 0);
if (s == NULL) return PyErr_NoMemory(); if (s == NULL) return NULL;
s->ds = ds; s->ds = ds;
s->active = 0; s->active = 0;

View File

@ -370,7 +370,7 @@ rpmfi fiFromFi(rpmfiObject * s)
PyObject * rpmfi_Wrap(PyTypeObject *subtype, rpmfi fi) PyObject * rpmfi_Wrap(PyTypeObject *subtype, rpmfi fi)
{ {
rpmfiObject *s = (rpmfiObject *)subtype->tp_alloc(subtype, 0); rpmfiObject *s = (rpmfiObject *)subtype->tp_alloc(subtype, 0);
if (s == NULL) return PyErr_NoMemory(); if (s == NULL) return NULL;
s->fi = fi; s->fi = fi;
s->active = 0; s->active = 0;

View File

@ -179,7 +179,7 @@ PyTypeObject rpmKeyring_Type = {
PyObject * rpmPubkey_Wrap(PyTypeObject *subtype, rpmPubkey pubkey) PyObject * rpmPubkey_Wrap(PyTypeObject *subtype, rpmPubkey pubkey)
{ {
rpmPubkeyObject *s = (rpmPubkeyObject *)subtype->tp_alloc(subtype, 0); rpmPubkeyObject *s = (rpmPubkeyObject *)subtype->tp_alloc(subtype, 0);
if (s == NULL) return PyErr_NoMemory(); if (s == NULL) return NULL;
s->pubkey = pubkey; s->pubkey = pubkey;
return (PyObject*) s; return (PyObject*) s;
@ -188,7 +188,7 @@ PyObject * rpmPubkey_Wrap(PyTypeObject *subtype, rpmPubkey pubkey)
PyObject * rpmKeyring_Wrap(PyTypeObject *subtype, rpmKeyring keyring) PyObject * rpmKeyring_Wrap(PyTypeObject *subtype, rpmKeyring keyring)
{ {
rpmKeyringObject *s = (rpmKeyringObject *)subtype->tp_alloc(subtype, 0); rpmKeyringObject *s = (rpmKeyringObject *)subtype->tp_alloc(subtype, 0);
if (s == NULL) return PyErr_NoMemory(); if (s == NULL) return NULL;
s->keyring = keyring; s->keyring = keyring;
return (PyObject*) s; return (PyObject*) s;

View File

@ -192,7 +192,7 @@ PyTypeObject rpmmi_Type = {
PyObject * rpmmi_Wrap(PyTypeObject *subtype, rpmdbMatchIterator mi, PyObject *s) PyObject * rpmmi_Wrap(PyTypeObject *subtype, rpmdbMatchIterator mi, PyObject *s)
{ {
rpmmiObject * mio = (rpmmiObject *)subtype->tp_alloc(subtype, 0); rpmmiObject * mio = (rpmmiObject *)subtype->tp_alloc(subtype, 0);
if (mio == NULL) return PyErr_NoMemory(); if (mio == NULL) return NULL;
mio->mi = mi; mio->mi = mi;
mio->ref = s; mio->ref = s;

View File

@ -121,7 +121,7 @@ PyTypeObject rpmProblem_Type = {
static PyObject *rpmprob_Wrap(PyTypeObject *subtype, rpmProblem prob) static PyObject *rpmprob_Wrap(PyTypeObject *subtype, rpmProblem prob)
{ {
rpmProblemObject * s = (rpmProblemObject *)subtype->tp_alloc(subtype, 0); rpmProblemObject * s = (rpmProblemObject *)subtype->tp_alloc(subtype, 0);
if (s == NULL) return PyErr_NoMemory(); if (s == NULL) return NULL;
s->prob = prob; s->prob = prob;
return (PyObject *) s; return (PyObject *) s;
@ -282,7 +282,7 @@ rpmps psFromPs(rpmpsObject * s)
PyObject * rpmps_Wrap(PyTypeObject *subtype, rpmps ps) PyObject * rpmps_Wrap(PyTypeObject *subtype, rpmps ps)
{ {
rpmpsObject * s = (rpmpsObject *)subtype->tp_alloc(subtype, 0); 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->ps = ps; /* XXX refcounts? */
s->psi = NULL; s->psi = NULL;

View File

@ -107,7 +107,7 @@ static PyObject *rpmtd_new(PyTypeObject * subtype, PyObject *args, PyObject *kwd
if (noext) flags &= ~HEADERGET_EXT; if (noext) flags &= ~HEADERGET_EXT;
if ((s = (rpmtdObject *)subtype->tp_alloc(subtype, 0)) == NULL) if ((s = (rpmtdObject *)subtype->tp_alloc(subtype, 0)) == NULL)
return PyErr_NoMemory(); return NULL;
headerGet(h, tag, &(s->td), flags); headerGet(h, tag, &(s->td), flags);

View File

@ -312,7 +312,7 @@ PyTypeObject rpmte_Type = {
PyObject * rpmte_Wrap(PyTypeObject *subtype, rpmte te) PyObject * rpmte_Wrap(PyTypeObject *subtype, rpmte te)
{ {
rpmteObject *s = (rpmteObject *)subtype->tp_alloc(subtype, 0); rpmteObject *s = (rpmteObject *)subtype->tp_alloc(subtype, 0);
if (s == NULL) return PyErr_NoMemory(); if (s == NULL) return NULL;
s->te = te; s->te = te;
return (PyObject *) s; return (PyObject *) s;

View File

@ -848,7 +848,7 @@ PyTypeObject rpmts_Type = {
PyObject * rpmts_Wrap(PyTypeObject *subtype, rpmts ts) PyObject * rpmts_Wrap(PyTypeObject *subtype, rpmts ts)
{ {
rpmtsObject * s = (rpmtsObject *)subtype->tp_alloc(subtype, 0); rpmtsObject * s = (rpmtsObject *)subtype->tp_alloc(subtype, 0);
if (s == NULL) return PyErr_NoMemory(); if (s == NULL) return NULL;
s->ts = ts; s->ts = ts;
s->scriptFd = NULL; s->scriptFd = NULL;

View File

@ -228,7 +228,7 @@ PyObject *
spec_Wrap(PyTypeObject *subtype, rpmSpec spec) spec_Wrap(PyTypeObject *subtype, rpmSpec spec)
{ {
specObject * s = (specObject *)subtype->tp_alloc(subtype, 0); specObject * s = (specObject *)subtype->tp_alloc(subtype, 0);
if (s == NULL) return PyErr_NoMemory(); if (s == NULL) return NULL;
s->spec = spec; s->spec = spec;
return (PyObject *) s; return (PyObject *) s;