mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
Implement PEP 3121: new module initialization and finalization API.
This commit is contained in:
parent
cdf94635d7
commit
1a21451b1d
113 changed files with 2230 additions and 855 deletions
|
|
@ -1191,11 +1191,26 @@ static PyMethodDef marshal_methods[] = {
|
|||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
static struct PyModuleDef impmodule = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"marshal",
|
||||
NULL,
|
||||
0,
|
||||
marshal_methods,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
|
||||
PyMODINIT_FUNC
|
||||
PyMarshal_Init(void)
|
||||
{
|
||||
PyObject *mod = Py_InitModule("marshal", marshal_methods);
|
||||
PyObject *mod = PyModule_Create(&impmodule);
|
||||
if (mod == NULL)
|
||||
return;
|
||||
return NULL;
|
||||
PyModule_AddIntConstant(mod, "version", Py_MARSHAL_VERSION);
|
||||
return mod;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue