From b47de0ba7f88f163175ac4ce24542f048554ff10 Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Sat, 21 Sep 2013 21:15:30 +1000 Subject: [PATCH] Prevent core dump when attempt to delete __wrapped__ on C implementation. Raise TypeError instead. --- src/_wrappers.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/_wrappers.c b/src/_wrappers.c index b6eeaca..d920357 100644 --- a/src/_wrappers.c +++ b/src/_wrappers.c @@ -1117,6 +1117,11 @@ static int WraptObjectProxy_set_wrapped(WraptObjectProxyObject *self, return -1; } + if (!value) { + PyErr_SetString(PyExc_TypeError, "__wrapped__ must be an object"); + return -1; + } + Py_INCREF(value); Py_DECREF(self->wrapped);