diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-04-18 10:48:00 -0400 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-04-18 10:48:00 -0400 |
commit | f67d48c67432fafbe397e581a419ac8408bd9463 (patch) | |
tree | 5713712500d7e79eb6a13ae34d9a5104b2b9a8b2 /Python/errors.c | |
parent | 013a85ff656fa0156dbfe26ec30698ebb9bfdf70 (diff) | |
download | cpython-f67d48c67432fafbe397e581a419ac8408bd9463.tar.gz |
fix refcnt/style/debuging oversights
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Python/errors.c b/Python/errors.c index 63eebe2e77..558404a1ee 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -593,13 +593,15 @@ PyErr_SetImportError(PyObject *msg, PyObject *name, PyObject *path) if (msg == NULL) return NULL; - args = PyTuple_New(1); + args = PyTuple_New(0); if (args == NULL) return NULL; kwargs = PyDict_New(); - if (kwargs == NULL) + if (kwargs == NULL) { + Py_DECREF(args); return NULL; + } if (name == NULL) { Py_INCREF(Py_None); @@ -612,13 +614,13 @@ PyErr_SetImportError(PyObject *msg, PyObject *name, PyObject *path) } Py_INCREF(msg); - PyTuple_SetItem(args, 0, NULL);//msg); + PyTuple_SET_ITEM(args, 0, msg); PyDict_SetItemString(kwargs, "name", name); PyDict_SetItemString(kwargs, "path", path); error = PyObject_Call(PyExc_ImportError, args, kwargs); - if (error!= NULL) { - PyErr_SetObject((PyObject *) Py_TYPE(error), error); + if (error != NULL) { + PyErr_SetObject((PyObject *)Py_TYPE(error), error); Py_DECREF(error); } |