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/Lib/test/test_frame.py b/Lib/test/test_frame.py
index fd79508..d6aa283 100644
--- a/Lib/test/test_frame.py
+++ b/Lib/test/test_frame.py
@@ -109,10 +109,7 @@
             self.assertIs(None, wr())
 
 
-class FrameLocalsTest(unittest.TestCase):
-    """
-    Tests for the .f_locals attribute.
-    """
+class FrameAttrsTest(unittest.TestCase):
 
     def make_frames(self):
         def outer():
@@ -159,6 +156,11 @@
         self.assertEqual(outer.f_locals, {})
         self.assertEqual(inner.f_locals, {})
 
+    def test_f_lineno_del_segfault(self):
+        f, _, _ = self.make_frames()
+        with self.assertRaises(AttributeError):
+            del f.f_lineno
+
 
 class ReprTest(unittest.TestCase):
     """