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

diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 269f003..4e3352d 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -3625,6 +3625,10 @@
 set_post_handshake_auth(PySSLContext *self, PyObject *arg, void *c) {
     int (*verify_cb)(int, X509_STORE_CTX *) = NULL;
     int mode = SSL_CTX_get_verify_mode(self->ctx);
+    if (arg == NULL) {
+        PyErr_SetString(PyExc_AttributeError, "cannot delete attribute");
+        return -1;
+    }
     int pha = PyObject_IsTrue(arg);
 
     if (pha == -1) {