Issue #18520: Add a new PyStructSequence_InitType2() function, same than
PyStructSequence_InitType() except that it has a return value (0 on success,
-1 on error).
* PyStructSequence_InitType2() now raises MemoryError on memory allocation failure
* Fix also some calls to PyDict_SetItemString(): handle error
diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c
index d4ef733..9909400 100644
--- a/Modules/pwdmodule.c
+++ b/Modules/pwdmodule.c
@@ -216,8 +216,9 @@
return NULL;
if (!initialized) {
- PyStructSequence_InitType(&StructPwdType,
- &struct_pwd_type_desc);
+ if (PyStructSequence_InitType2(&StructPwdType,
+ &struct_pwd_type_desc) < 0)
+ return NULL;
initialized = 1;
}
Py_INCREF((PyObject *) &StructPwdType);