Set type_attr to NULL after the assignment to stgdict->proto (like
what is done with stgdict after the Py_SETREF() call) so that it is
not decrefed twice on error.
(cherry picked from commit
5e333784f007950f22de44c1ffab5b0c03d6691f)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
--- /dev/null
+Fix a possible double decref in _ctypes.c's ``PyCArrayType_new()``.
stgdict->align = itemalign;
stgdict->length = length;
stgdict->proto = type_attr;
+ type_attr = NULL;
stgdict->paramfunc = &PyCArrayType_paramfunc;