diff options
| author | Guido van Rossum <guido@python.org> | 2008-01-23 20:09:39 (GMT) | 
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 2008-01-23 20:09:39 (GMT) | 
| commit | e105f980460131d192d955fca0df474bcf1c642c (patch) | |
| tree | d728596ff034128a3dc73a2ecf20c102a55e4059 /Python | |
| parent | 2529aa984082a11e7abac97d608bd91adc844dc2 (diff) | |
| download | cpython-e105f980460131d192d955fca0df474bcf1c642c.zip cpython-e105f980460131d192d955fca0df474bcf1c642c.tar.gz cpython-e105f980460131d192d955fca0df474bcf1c642c.tar.bz2  | |
Fix two crashers (borrowed_ref_[34].py from the trunk).
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/bltinmodule.c | 7 | ||||
| -rw-r--r-- | Python/ceval.c | 6 | 
2 files changed, 11 insertions, 2 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index ceb2fc7..f82430c 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -1218,11 +1218,14 @@ min_max(PyObject *args, PyObject *kwds, int op)  				"%s() got an unexpected keyword argument", name);  			return NULL;  		} +		Py_INCREF(keyfunc);  	}  	it = PyObject_GetIter(v); -	if (it == NULL) +	if (it == NULL) { +		Py_XDECREF(keyfunc);  		return NULL; +	}  	maxitem = NULL; /* the result */  	maxval = NULL;  /* the value associated with the result */ @@ -1271,6 +1274,7 @@ min_max(PyObject *args, PyObject *kwds, int op)  	else  		Py_DECREF(maxval);  	Py_DECREF(it); +	Py_XDECREF(keyfunc);  	return maxitem;  Fail_it_item_and_val: @@ -1281,6 +1285,7 @@ Fail_it:  	Py_XDECREF(maxval);  	Py_XDECREF(maxitem);  	Py_DECREF(it); +	Py_XDECREF(keyfunc);  	return NULL;  } diff --git a/Python/ceval.c b/Python/ceval.c index 4f6b731..06d524b 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2036,6 +2036,7 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)  						"__import__ not found");  				break;  			} +			Py_INCREF(x);  			v = POP();  			u = TOP();  			if (PyInt_AsLong(u) != -1 || PyErr_Occurred()) @@ -2057,11 +2058,14 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throwflag)  			Py_DECREF(u);  			if (w == NULL) {  				u = POP(); +				Py_DECREF(x);  				x = NULL;  				break;  			}  			READ_TIMESTAMP(intr0); -			x = PyEval_CallObject(x, w); +			v = x; +			x = PyEval_CallObject(v, w); +			Py_DECREF(v);  			READ_TIMESTAMP(intr1);  			Py_DECREF(w);  			SET_TOP(x);  | 
