diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-07-22 20:24:54 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-07-22 20:24:54 (GMT) |
commit | 1c8f059019d79f1891f42a2656a96919a1187967 (patch) | |
tree | bcec768e9ca0d0e1e9e1ab80e0dfc0fe29ae758d /Modules/pwdmodule.c | |
parent | 2a545099f7ed45de1d45b45200d82c6298b75d2b (diff) | |
download | cpython-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/pwdmodule.c')
-rw-r--r-- | Modules/pwdmodule.c | 5 |
1 files changed, 3 insertions, 2 deletions
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 @@ PyInit_pwd(void) 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); |