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_io.py b/Lib/test/test_io.py
index b41141e..4c206d2 100644
--- a/Lib/test/test_io.py
+++ b/Lib/test/test_io.py
@@ -3635,6 +3635,11 @@
             t2.buddy = t1
         support.gc_collect()
 
+    def test_del__CHUNK_SIZE_SystemError(self):
+        t = self.TextIOWrapper(self.BytesIO(), encoding='ascii')
+        with self.assertRaises(AttributeError):
+            del t._CHUNK_SIZE
+
 
 class PyTextIOWrapperTest(TextIOWrapperTest):
     io = pyio