Mercurial > cpython-lru_cache-weakref
diff Objects/funcobject.c @ 40021:5bec4a67ff0d 2.4
[Backport r50681 | neal.norwitz]
PyFunction_SetDefaults() is documented as taking None or a tuple.
A NULL would crash the PyTuple_Check(). Now make NULL return a SystemError.
Reported by Klocwork #73.
| author | Andrew M. Kuchling <amk@amk.ca> |
|---|---|
| date | Thu, 05 Oct 2006 19:38:17 +0000 |
| parents | f019e4f86287 |
| children |
line wrap: on
line diff
--- a/Objects/funcobject.c Thu Oct 05 19:32:52 2006 +0000 +++ b/Objects/funcobject.c Thu Oct 05 19:38:17 2006 +0000 @@ -109,8 +109,8 @@ } if (defaults == Py_None) defaults = NULL; - else if (PyTuple_Check(defaults)) { - Py_XINCREF(defaults); + else if (defaults && PyTuple_Check(defaults)) { + Py_INCREF(defaults); } else { PyErr_SetString(PyExc_SystemError, "non-tuple default args");
