From 842acaab1376c5c84fd5966bb6070e289880e1ca Mon Sep 17 00:00:00 2001 From: Zackery Spytz Date: Mon, 17 Dec 2018 07:52:45 -0700 Subject: bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. (GH-11175) --- Objects/frameobject.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Objects/frameobject.c') diff --git a/Objects/frameobject.c b/Objects/frameobject.c index 400f99f6c9..8488b96a9a 100644 --- a/Objects/frameobject.c +++ b/Objects/frameobject.c @@ -105,6 +105,10 @@ frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno, void *Py_UNUSED(ignore int blockstack[CO_MAXBLOCKS]; /* Walking the 'finally' blocks */ int blockstack_top = 0; /* (ditto) */ + if (p_new_lineno == NULL) { + PyErr_SetString(PyExc_AttributeError, "cannot delete attribute"); + return -1; + } /* f_lineno must be an integer. */ if (!PyLong_CheckExact(p_new_lineno)) { PyErr_SetString(PyExc_ValueError, -- cgit v1.2.1