summaryrefslogtreecommitdiffstats
path: root/Modules/spwdmodule.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-07-22 20:24:54 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-07-22 20:24:54 (GMT)
commit1c8f059019d79f1891f42a2656a96919a1187967 (patch)
treebcec768e9ca0d0e1e9e1ab80e0dfc0fe29ae758d /Modules/spwdmodule.c
parent2a545099f7ed45de1d45b45200d82c6298b75d2b (diff)
downloadcpython-1c8f059019d79f1891f42a2656a96919a1187967.zip
cpython-1c8f059019d79f1891f42a2656a96919a1187967.tar.gz
cpython-1c8f059019d79f1891f42a2656a96919a1187967.tar.bz2
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
Diffstat (limited to 'Modules/spwdmodule.c')
-rw-r--r--Modules/spwdmodule.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/spwdmodule.c b/Modules/spwdmodule.c
index 194ae19..d06f8ce 100644
--- a/Modules/spwdmodule.c
+++ b/Modules/spwdmodule.c
@@ -196,9 +196,11 @@ PyInit_spwd(void)
m=PyModule_Create(&spwdmodule);
if (m == NULL)
return NULL;
- if (!initialized)
- PyStructSequence_InitType(&StructSpwdType,
- &struct_spwd_type_desc);
+ if (!initialized) {
+ if (PyStructSequence_InitType2(&StructSpwdType,
+ &struct_spwd_type_desc) < 0)
+ return NULL;
+ }
Py_INCREF((PyObject *) &StructSpwdType);
PyModule_AddObject(m, "struct_spwd", (PyObject *) &StructSpwdType);
initialized = 1;