summaryrefslogtreecommitdiffstats
path: root/Modules/clinic/posixmodule.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/clinic/posixmodule.c.h')
-rw-r--r--Modules/clinic/posixmodule.c.h63
1 files changed, 56 insertions, 7 deletions
diff --git a/Modules/clinic/posixmodule.c.h b/Modules/clinic/posixmodule.c.h
index b691cfb..6533edf 100644
--- a/Modules/clinic/posixmodule.c.h
+++ b/Modules/clinic/posixmodule.c.h
@@ -1674,12 +1674,28 @@ os_system(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"command", NULL};
- static _PyArg_Parser _parser = {"u:system", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "system", 0};
+ PyObject *argsbuf[1];
const Py_UNICODE *command;
long _return_value;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &command)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!PyUnicode_Check(args[0])) {
+ _PyArg_BadArgument("system", "argument 'command'", "str", args[0]);
+ goto exit;
+ }
+ #if USE_UNICODE_WCHAR_CACHE
+ _Py_COMP_DIAG_PUSH
+ _Py_COMP_DIAG_IGNORE_DEPR_DECLS
+ command = _PyUnicode_AsUnicode(args[0]);
+ _Py_COMP_DIAG_POP
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ command = PyUnicode_AsWideCharString(args[0], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (command == NULL) {
goto exit;
}
_return_value = os_system_impl(module, command);
@@ -1689,6 +1705,11 @@ os_system(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *k
return_value = PyLong_FromLong(_return_value);
exit:
+ /* Cleanup for command */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)command);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+
return return_value;
}
@@ -6998,19 +7019,47 @@ os_startfile(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"filepath", "operation", NULL};
- static _PyArg_Parser _parser = {"O&|u:startfile", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "startfile", 0};
+ PyObject *argsbuf[2];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 1;
path_t filepath = PATH_T_INITIALIZE("startfile", "filepath", 0, 0);
const Py_UNICODE *operation = NULL;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- path_converter, &filepath, &operation)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!path_converter(args[0], &filepath)) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (!PyUnicode_Check(args[1])) {
+ _PyArg_BadArgument("startfile", "argument 'operation'", "str", args[1]);
goto exit;
}
+ #if USE_UNICODE_WCHAR_CACHE
+ _Py_COMP_DIAG_PUSH
+ _Py_COMP_DIAG_IGNORE_DEPR_DECLS
+ operation = _PyUnicode_AsUnicode(args[1]);
+ _Py_COMP_DIAG_POP
+ #else /* USE_UNICODE_WCHAR_CACHE */
+ operation = PyUnicode_AsWideCharString(args[1], NULL);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
+ if (operation == NULL) {
+ goto exit;
+ }
+skip_optional_pos:
return_value = os_startfile_impl(module, &filepath, operation);
exit:
/* Cleanup for filepath */
path_cleanup(&filepath);
+ /* Cleanup for operation */
+ #if !USE_UNICODE_WCHAR_CACHE
+ PyMem_Free((void *)operation);
+ #endif /* USE_UNICODE_WCHAR_CACHE */
return return_value;
}
@@ -8876,4 +8925,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=d7c1212a94613496 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=ba3d4b35fda2c208 input=a9049054013a1b77]*/