mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
|
@ -1099,12 +1099,25 @@ PyDoc_STRVAR(module_doc,
|
|||
"This module is always available. It provides access to the\n"
|
||||
"mathematical functions defined by the C standard.");
|
||||
|
||||
|
||||
static struct PyModuleDef mathmodule = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"math",
|
||||
module_doc,
|
||||
-1,
|
||||
math_methods,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
PyMODINIT_FUNC
|
||||
initmath(void)
|
||||
PyInit_math(void)
|
||||
{
|
||||
PyObject *m;
|
||||
|
||||
m = Py_InitModule3("math", math_methods, module_doc);
|
||||
m = PyModule_Create(&mathmodule);
|
||||
if (m == NULL)
|
||||
goto finally;
|
||||
|
||||
|
@ -1112,5 +1125,5 @@ initmath(void)
|
|||
PyModule_AddObject(m, "e", PyFloat_FromDouble(Py_MATH_E));
|
||||
|
||||
finally:
|
||||
return;
|
||||
return m;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue