aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Modules/grpmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/grpmodule.c')
-rw-r--r--Modules/grpmodule.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c
index 042cf0554a3..c8a93723eae 100644
--- a/Modules/grpmodule.c
+++ b/Modules/grpmodule.c
@@ -58,17 +58,12 @@ mkgrent(struct group *p)
#define SET(i,val) PyStructSequence_SET_ITEM(v, i, val)
SET(setIndex++, PyUnicode_DecodeFSDefault(p->gr_name));
-#ifdef __VMS
- SET(setIndex++, Py_None);
- Py_INCREF(Py_None);
-#else
if (p->gr_passwd)
SET(setIndex++, PyUnicode_DecodeFSDefault(p->gr_passwd));
else {
SET(setIndex++, Py_None);
Py_INCREF(Py_None);
}
-#endif
SET(setIndex++, _PyLong_FromGid(p->gr_gid));
SET(setIndex++, w);
#undef SET
@@ -210,9 +205,14 @@ PyInit_grp(void)
if (m == NULL)
return NULL;
d = PyModule_GetDict(m);
- if (!initialized)
- PyStructSequence_InitType(&StructGrpType, &struct_group_type_desc);
- PyDict_SetItemString(d, "struct_group", (PyObject *) &StructGrpType);
+ if (!initialized) {
+ if (PyStructSequence_InitType2(&StructGrpType,
+ &struct_group_type_desc) < 0)
+ return NULL;
+ }
+ if (PyDict_SetItemString(d, "struct_group",
+ (PyObject *)&StructGrpType) < 0)
+ return NULL;
initialized = 1;
return m;
}