bpo-29802: Fix reference counting in module-level struct functions (#1213)

when pass arguments of wrong type.
diff --git a/Modules/_struct.c b/Modules/_struct.c
index 4bc4186..a614be8 100644
--- a/Modules/_struct.c
+++ b/Modules/_struct.c
@@ -2083,6 +2083,7 @@
 
     if (fmt == NULL) {
         Py_DECREF(*ptr);
+        *ptr = NULL;
         return 1;
     }