summaryrefslogtreecommitdiff
path: root/Modules/clinic
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2020-05-10 11:05:29 +0200
committerGitHub <noreply@github.com>2020-05-10 11:05:29 +0200
commit1c2fa781560608aa4be50c748d4b3f403cfa5035 (patch)
treed9346d8ab7e510f8d296ae37c3401607a2bff4fd /Modules/clinic
parentfcb285609a2e55f2dc63dcfbb32e4e2fddf71546 (diff)
downloadcpython-git-1c2fa781560608aa4be50c748d4b3f403cfa5035.tar.gz
bpo-40549: Convert posixmodule.c to multiphase init (GH-19982)
Convert posixmodule.c ("posix" or "nt" module) to the multiphase initialization (PEP 489). * Create the module using PyModuleDef_Init(). * Create ScandirIteratorType and DirEntryType with the new PyType_FromModuleAndSpec() (PEP 573) * Get the module state from ScandirIteratorType and DirEntryType with the new PyType_GetModule() (PEP 573) * Pass module to functions which access the module state. * convert_sched_param() gets a new module parameter. It is now called directly since Argument Clinic doesn't support passing the module to an argument converter callback. * Remove _posixstate_global macro.
Diffstat (limited to 'Modules/clinic')
-rw-r--r--Modules/clinic/posixmodule.c.h23
1 files changed, 11 insertions, 12 deletions
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index a2b4566443..cf6d7449ba 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -2886,7 +2886,7 @@ PyDoc_STRVAR(os_sched_setscheduler__doc__,
static PyObject *
os_sched_setscheduler_impl(PyObject *module, pid_t pid, int policy,
- struct sched_param *param);
+ PyObject *param_obj);
static PyObject *
os_sched_setscheduler(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
@@ -2894,13 +2894,13 @@ os_sched_setscheduler(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
PyObject *return_value = NULL;
pid_t pid;
int policy;
- struct sched_param param;
+ PyObject *param_obj;
- if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "iO&:sched_setscheduler",
- &pid, &policy, convert_sched_param, &param)) {
+ if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "iO:sched_setscheduler",
+ &pid, &policy, &param_obj)) {
goto exit;
}
- return_value = os_sched_setscheduler_impl(module, pid, policy, &param);
+ return_value = os_sched_setscheduler_impl(module, pid, policy, param_obj);
exit:
return return_value;
@@ -2957,21 +2957,20 @@ PyDoc_STRVAR(os_sched_setparam__doc__,
{"sched_setparam", (PyCFunction)(void(*)(void))os_sched_setparam, METH_FASTCALL, os_sched_setparam__doc__},
static PyObject *
-os_sched_setparam_impl(PyObject *module, pid_t pid,
- struct sched_param *param);
+os_sched_setparam_impl(PyObject *module, pid_t pid, PyObject *param_obj);
static PyObject *
os_sched_setparam(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
{
PyObject *return_value = NULL;
pid_t pid;
- struct sched_param param;
+ PyObject *param_obj;
- if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "O&:sched_setparam",
- &pid, convert_sched_param, &param)) {
+ if (!_PyArg_ParseStack(args, nargs, "" _Py_PARSE_PID "O:sched_setparam",
+ &pid, &param_obj)) {
goto exit;
}
- return_value = os_sched_setparam_impl(module, pid, &param);
+ return_value = os_sched_setparam_impl(module, pid, param_obj);
exit:
return return_value;
@@ -9418,4 +9417,4 @@ exit:
#ifndef OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#define OS_WAITSTATUS_TO_EXITCODE_METHODDEF
#endif /* !defined(OS_WAITSTATUS_TO_EXITCODE_METHODDEF) */
-/*[clinic end generated code: output=ba73b68f1c435ff6 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=be90d3aba972098b input=a9049054013a1b77]*/