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:
parent
4e5132e443
commit
dc6946e72e
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue