| 1 |
/*[clinic input] |
| 2 |
preserve |
| 3 |
[clinic start generated code]*/ |
| 4 |
|
| 5 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 6 |
# include "pycore_gc.h" // PyGC_Head |
| 7 |
# include "pycore_runtime.h" // _Py_ID() |
| 8 |
#endif |
| 9 |
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords() |
| 10 |
|
| 11 |
PyDoc_STRVAR(_wmi_exec_query__doc__, |
| 12 |
"exec_query($module, /, query)\n" |
| 13 |
"--\n" |
| 14 |
"\n" |
| 15 |
"Runs a WMI query against the local machine.\n" |
| 16 |
"\n" |
| 17 |
"This returns a single string with \'name=value\' pairs in a flat array\n" |
| 18 |
"separated by null characters."); |
| 19 |
|
| 20 |
#define _WMI_EXEC_QUERY_METHODDEF \ |
| 21 |
{"exec_query", _PyCFunction_CAST(_wmi_exec_query), METH_FASTCALL|METH_KEYWORDS, _wmi_exec_query__doc__}, |
| 22 |
|
| 23 |
static PyObject * |
| 24 |
_wmi_exec_query_impl(PyObject *module, PyObject *query); |
| 25 |
|
| 26 |
static PyObject * |
| 27 |
_wmi_exec_query(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 28 |
{ |
| 29 |
PyObject *return_value = NULL; |
| 30 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 31 |
|
| 32 |
#define NUM_KEYWORDS 1 |
| 33 |
static struct { |
| 34 |
PyGC_Head _this_is_not_used; |
| 35 |
PyObject_VAR_HEAD |
| 36 |
Py_hash_t ob_hash; |
| 37 |
PyObject *ob_item[NUM_KEYWORDS]; |
| 38 |
} _kwtuple = { |
| 39 |
.ob_base = PyVarObject_HEAD_INIT(&PyTuple_Type, NUM_KEYWORDS) |
| 40 |
.ob_hash = -1, |
| 41 |
.ob_item = { &_Py_ID(query), }, |
| 42 |
}; |
| 43 |
#undef NUM_KEYWORDS |
| 44 |
#define KWTUPLE (&_kwtuple.ob_base.ob_base) |
| 45 |
|
| 46 |
#else // !Py_BUILD_CORE |
| 47 |
# define KWTUPLE NULL |
| 48 |
#endif // !Py_BUILD_CORE |
| 49 |
|
| 50 |
static const char * const _keywords[] = {"query", NULL}; |
| 51 |
static _PyArg_Parser _parser = { |
| 52 |
.keywords = _keywords, |
| 53 |
.fname = "exec_query", |
| 54 |
.kwtuple = KWTUPLE, |
| 55 |
}; |
| 56 |
#undef KWTUPLE |
| 57 |
PyObject *argsbuf[1]; |
| 58 |
PyObject *query; |
| 59 |
|
| 60 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 61 |
/*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 62 |
if (!args) { |
| 63 |
goto exit; |
| 64 |
} |
| 65 |
if (!PyUnicode_Check(args[0])) { |
| 66 |
_PyArg_BadArgument("exec_query", "argument 'query'", "str", args[0]); |
| 67 |
goto exit; |
| 68 |
} |
| 69 |
query = args[0]; |
| 70 |
return_value = _wmi_exec_query_impl(module, query); |
| 71 |
|
| 72 |
exit: |
| 73 |
return return_value; |
| 74 |
} |
| 75 |
/*[clinic end generated code: output=f246d0e568cc2d2c input=a9049054013a1b77]*/ |