diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/symtable.c | 42 |
1 files changed, 26 insertions, 16 deletions
diff --git a/Python/symtable.c b/Python/symtable.c index d0a0c5d..f10e382 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -658,6 +658,7 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free, { PyObject *name, *v, *local = NULL, *scopes = NULL, *newbound = NULL; PyObject *newglobal = NULL, *newfree = NULL, *allfree = NULL; + PyObject *temp; int i, success = 0; Py_ssize_t pos = 0; @@ -696,14 +697,16 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free, */ if (ste->ste_type == ClassBlock) { /* Pass down known globals */ - if (!PyNumber_InPlaceOr(newglobal, global)) + temp = PyNumber_InPlaceOr(newglobal, global); + if (!temp) goto error; - Py_DECREF(newglobal); + Py_DECREF(temp); /* Pass down previously bound symbols */ if (bound) { - if (!PyNumber_InPlaceOr(newbound, bound)) + temp = PyNumber_InPlaceOr(newbound, bound); + if (!temp) goto error; - Py_DECREF(newbound); + Py_DECREF(temp); } } @@ -718,20 +721,23 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free, if (ste->ste_type != ClassBlock) { /* Add function locals to bound set */ if (ste->ste_type == FunctionBlock) { - if (!PyNumber_InPlaceOr(newbound, local)) + temp = PyNumber_InPlaceOr(newbound, local); + if (!temp) goto error; - Py_DECREF(newbound); + Py_DECREF(temp); } /* Pass down previously bound symbols */ if (bound) { - if (!PyNumber_InPlaceOr(newbound, bound)) + temp = PyNumber_InPlaceOr(newbound, bound); + if (!temp) goto error; - Py_DECREF(newbound); + Py_DECREF(temp); } /* Pass down known globals */ - if (!PyNumber_InPlaceOr(newglobal, global)) + temp = PyNumber_InPlaceOr(newglobal, global); + if (!temp) goto error; - Py_DECREF(newglobal); + Py_DECREF(temp); } else { /* Special-case __class__ */ @@ -764,9 +770,10 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free, ste->ste_child_free = 1; } - if (PyNumber_InPlaceOr(newfree, allfree) < 0) + temp = PyNumber_InPlaceOr(newfree, allfree); + if (!temp) goto error; - Py_DECREF(newfree); + Py_DECREF(temp); /* Check if any local variables must be converted to cell variables */ if (ste->ste_type == FunctionBlock && !analyze_cells(scopes, newfree, @@ -782,9 +789,10 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free, if (!check_unoptimized(ste)) goto error; - if (!PyNumber_InPlaceOr(free, newfree)) + temp = PyNumber_InPlaceOr(free, newfree); + if (!temp) goto error; - Py_DECREF(free); + Py_DECREF(temp); success = 1; error: Py_XDECREF(scopes); @@ -803,6 +811,7 @@ analyze_child_block(PySTEntryObject *entry, PyObject *bound, PyObject *free, PyObject *global, PyObject* child_free) { PyObject *temp_bound = NULL, *temp_global = NULL, *temp_free = NULL; + PyObject *temp; /* Copy the bound and global dictionaries. @@ -823,9 +832,10 @@ analyze_child_block(PySTEntryObject *entry, PyObject *bound, PyObject *free, if (!analyze_block(entry, temp_bound, temp_free, temp_global)) goto error; - if (PyNumber_InPlaceOr(child_free, temp_free) < 0) + temp = PyNumber_InPlaceOr(child_free, temp_free); + if (!temp) goto error; - Py_DECREF(child_free); + Py_DECREF(temp); Py_DECREF(temp_bound); Py_DECREF(temp_free); Py_DECREF(temp_global); |