mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
Initialize structseq types only once.
This commit is contained in:
parent
d18d5a3153
commit
19ab6c98cf
8 changed files with 52 additions and 17 deletions
|
@ -52,6 +52,7 @@ static PyStructSequence_Desc struct_spwd_type_desc = {
|
|||
9,
|
||||
};
|
||||
|
||||
static int initialized;
|
||||
static PyTypeObject StructSpwdType;
|
||||
|
||||
|
||||
|
@ -173,7 +174,10 @@ initspwd(void)
|
|||
m=Py_InitModule3("spwd", spwd_methods, spwd__doc__);
|
||||
if (m == NULL)
|
||||
return;
|
||||
PyStructSequence_InitType(&StructSpwdType, &struct_spwd_type_desc);
|
||||
if (!initialized)
|
||||
PyStructSequence_InitType(&StructSpwdType,
|
||||
&struct_spwd_type_desc);
|
||||
Py_INCREF((PyObject *) &StructSpwdType);
|
||||
PyModule_AddObject(m, "struct_spwd", (PyObject *) &StructSpwdType);
|
||||
initialized = 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue