From f3052036e71e1f6314477000533c55e31d1497ba Mon Sep 17 00:00:00 2001 From: Moshe Zadka Date: Fri, 30 Mar 2001 20:26:32 +0000 Subject: [PATCH] Fixed deleting func_defaults causes segmentation fault bug --- Misc/NEWS | 2 ++ Objects/funcobject.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Misc/NEWS b/Misc/NEWS index 48c84b6ed10d..f4e038386e24 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -50,6 +50,8 @@ http://sourceforge.net/tracker/index.php?func=detail&aid=&group_id=5470&atid - Add TELL64() hack #ifdef to FreeBSD, Apple and BSDI +- del func.func_defaults raises a TypeError instead of dumping core + What's New in Python 2.0? ========================= diff --git a/Objects/funcobject.c b/Objects/funcobject.c index 8b045f4695ea..e312ffd55ea1 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -129,7 +129,8 @@ func_setattr(PyFunctionObject *op, char *name, PyObject *value) } } else if (strcmp(name, "func_defaults") == 0) { - if (value != Py_None && !PyTuple_Check(value)) { + if (value != Py_None && + (value == NULL || !PyTuple_Check(value))) { PyErr_SetString( PyExc_TypeError, "func_defaults must be set to a tuple object"); -- 2.47.3