summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Python/codecs.c6
-rw-r--r--Python/compile.c2
-rw-r--r--Python/symtable.c4
3 files changed, 8 insertions, 4 deletions
diff --git a/Python/codecs.c b/Python/codecs.c
index 4b8d983..5c521fb 100644
--- a/Python/codecs.c
+++ b/Python/codecs.c
@@ -36,8 +36,7 @@ int PyCodec_Register(PyObject *search_function)
goto onError;
}
if (!PyCallable_Check(search_function)) {
- PyErr_SetString(PyExc_TypeError,
- "argument must be callable");
+ PyErr_SetString(PyExc_TypeError, "argument must be callable");
goto onError;
}
return PyList_Append(interp->codec_search_path, search_function);
@@ -305,7 +304,7 @@ PyObject *PyCodec_Encode(PyObject *object,
const char *errors)
{
PyObject *encoder = NULL;
- PyObject *args = NULL, *result;
+ PyObject *args = NULL, *result = NULL;
PyObject *v;
encoder = PyCodec_Encoder(encoding);
@@ -336,6 +335,7 @@ PyObject *PyCodec_Encode(PyObject *object,
return v;
onError:
+ Py_XDECREF(result);
Py_XDECREF(args);
Py_XDECREF(encoder);
return NULL;
diff --git a/Python/compile.c b/Python/compile.c
index 5905c45..418194e 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1801,6 +1801,7 @@ compiler_lookup_arg(PyObject *dict, PyObject *name)
if (k == NULL)
return -1;
v = PyDict_GetItem(dict, k);
+ Py_DECREF(k);
if (v == NULL)
return -1;
return PyInt_AS_LONG(v);
@@ -2464,6 +2465,7 @@ compiler_from_import(struct compiler *c, stmt_ty s)
}
ADDOP_O(c, LOAD_CONST, names, consts);
+ Py_DECREF(names);
ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module, names);
for (i = 0; i < n; i++) {
alias_ty alias = asdl_seq_GET(s->v.ImportFrom.names, i);
diff --git a/Python/symtable.c b/Python/symtable.c
index 9eff334..016251c 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -1278,8 +1278,10 @@ symtable_visit_alias(struct symtable *st, alias_ty a)
else {
if (st->st_cur->ste_type != ModuleBlock) {
if (!symtable_warn(st,
- "import * only allowed at module level"))
+ "import * only allowed at module level")) {
+ Py_DECREF(store_name);
return 0;
+ }
}
st->st_cur->ste_unoptimized |= OPT_IMPORT_STAR;
Py_DECREF(store_name);