bpo-35504: Fix segfaults and SystemErrors when deleting certain attrs. (GH-11175)

(cherry picked from commit 842acaab1376c5c84fd5966bb6070e289880e1ca)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 4ef10d0..4362615 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -90,6 +90,10 @@
     int blockstack_top = 0;             /* (ditto) */
     unsigned char setup_op = 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,