mirror of
https://github.com/python/cpython.git
synced 2025-11-27 13:45:25 +00:00
bpo-1635741: Port fcntl module to multiphase initialization (GH-20540)
This commit is contained in:
parent
c8966667bb
commit
e9684fac5a
2 changed files with 20 additions and 22 deletions
|
|
@ -0,0 +1 @@
|
||||||
|
Port :mod:`fcntl` to multiphase initialization.
|
||||||
|
|
@ -662,34 +662,31 @@ all_ins(PyObject* m)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
fcntl_exec(PyObject *module)
|
||||||
|
{
|
||||||
|
if (all_ins(module) < 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PyModuleDef_Slot fcntl_slots[] = {
|
||||||
|
{Py_mod_exec, fcntl_exec},
|
||||||
|
{0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
static struct PyModuleDef fcntlmodule = {
|
static struct PyModuleDef fcntlmodule = {
|
||||||
PyModuleDef_HEAD_INIT,
|
PyModuleDef_HEAD_INIT,
|
||||||
"fcntl",
|
.m_name = "fcntl",
|
||||||
module_doc,
|
.m_doc = module_doc,
|
||||||
-1,
|
.m_size = 0,
|
||||||
fcntl_methods,
|
.m_methods = fcntl_methods,
|
||||||
NULL,
|
.m_slots = fcntl_slots,
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PyMODINIT_FUNC
|
PyMODINIT_FUNC
|
||||||
PyInit_fcntl(void)
|
PyInit_fcntl(void)
|
||||||
{
|
{
|
||||||
PyObject *m;
|
return PyModuleDef_Init(&fcntlmodule);
|
||||||
|
|
||||||
/* Create the module and add the functions and documentation */
|
|
||||||
m = PyModule_Create(&fcntlmodule);
|
|
||||||
if (m == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/* Add some symbolic constants to the module */
|
|
||||||
if (all_ins(m) < 0) {
|
|
||||||
Py_DECREF(m);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return m;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue