From: Benjamin Peterson Date: Tue, 12 May 2009 20:50:32 +0000 (+0000) Subject: Merged revisions 72589 via svnmerge from X-Git-Tag: 3.0~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9af8eaddfa9f849474d913a47838f279e9ab06f;p=thirdparty%2FPython%2Fcpython.git Merged revisions 72589 via svnmerge from svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r72589 | benjamin.peterson | 2009-05-12 15:39:25 -0500 (Tue, 12 May 2009) | 1 line fix error handling of PyNumber_InPlaceOr #6000 ........ --- diff --git a/Python/symtable.c b/Python/symtable.c index e787a74a93b9..02426f85051f 100644 --- a/Python/symtable.c +++ b/Python/symtable.c @@ -657,6 +657,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; @@ -695,14 +696,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); } } @@ -717,20 +720,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__ */ @@ -763,9 +769,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, @@ -781,9 +788,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); @@ -802,6 +810,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. @@ -822,9 +831,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);