2016-10-03 13:04:58 -03:00
|
|
|
/*[clinic input]
|
|
|
|
preserve
|
|
|
|
[clinic start generated code]*/
|
|
|
|
|
|
|
|
#if defined(MS_WINDOWS)
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_testconsole_write_input__doc__,
|
|
|
|
"write_input($module, /, file, s)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Writes UTF-16-LE encoded bytes to the console as if typed by a user.");
|
|
|
|
|
|
|
|
#define _TESTCONSOLE_WRITE_INPUT_METHODDEF \
|
2024-03-21 13:45:43 -03:00
|
|
|
{"write_input", (PyCFunction)(void(*)(void))_testconsole_write_input, METH_VARARGS|METH_KEYWORDS, _testconsole_write_input__doc__},
|
2016-10-03 13:04:58 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2024-03-21 13:45:43 -03:00
|
|
|
_testconsole_write_input_impl(PyObject *module, PyObject *file, Py_buffer *s);
|
2016-10-03 13:04:58 -03:00
|
|
|
|
|
|
|
static PyObject *
|
2024-03-21 13:45:43 -03:00
|
|
|
_testconsole_write_input(PyObject *module, PyObject *args, PyObject *kwargs)
|
2016-10-03 13:04:58 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
2024-03-21 13:45:43 -03:00
|
|
|
static char *_keywords[] = {"file", "s", NULL};
|
2016-10-03 13:04:58 -03:00
|
|
|
PyObject *file;
|
2024-03-21 13:45:43 -03:00
|
|
|
Py_buffer s = {NULL, NULL};
|
2016-10-03 13:04:58 -03:00
|
|
|
|
2024-03-21 13:45:43 -03:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "Oy*:write_input", _keywords,
|
|
|
|
&file, &s))
|
2019-03-14 05:32:22 -03:00
|
|
|
goto exit;
|
2024-03-21 13:45:43 -03:00
|
|
|
return_value = _testconsole_write_input_impl(module, file, &s);
|
2016-10-03 13:04:58 -03:00
|
|
|
|
|
|
|
exit:
|
2024-03-21 13:45:43 -03:00
|
|
|
/* Cleanup for s */
|
|
|
|
if (s.obj) {
|
|
|
|
PyBuffer_Release(&s);
|
|
|
|
}
|
|
|
|
|
2016-10-03 13:04:58 -03:00
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* defined(MS_WINDOWS) */
|
|
|
|
|
|
|
|
#if defined(MS_WINDOWS)
|
|
|
|
|
|
|
|
PyDoc_STRVAR(_testconsole_read_output__doc__,
|
|
|
|
"read_output($module, /, file)\n"
|
|
|
|
"--\n"
|
|
|
|
"\n"
|
|
|
|
"Reads a str from the console as written to stdout.");
|
|
|
|
|
|
|
|
#define _TESTCONSOLE_READ_OUTPUT_METHODDEF \
|
2024-03-21 13:45:43 -03:00
|
|
|
{"read_output", (PyCFunction)(void(*)(void))_testconsole_read_output, METH_VARARGS|METH_KEYWORDS, _testconsole_read_output__doc__},
|
2016-10-03 13:04:58 -03:00
|
|
|
|
|
|
|
static PyObject *
|
|
|
|
_testconsole_read_output_impl(PyObject *module, PyObject *file);
|
|
|
|
|
|
|
|
static PyObject *
|
2024-03-21 13:45:43 -03:00
|
|
|
_testconsole_read_output(PyObject *module, PyObject *args, PyObject *kwargs)
|
2016-10-03 13:04:58 -03:00
|
|
|
{
|
|
|
|
PyObject *return_value = NULL;
|
2024-03-21 13:45:43 -03:00
|
|
|
static char *_keywords[] = {"file", NULL};
|
2016-10-03 13:04:58 -03:00
|
|
|
PyObject *file;
|
|
|
|
|
2024-03-21 13:45:43 -03:00
|
|
|
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O:read_output", _keywords,
|
|
|
|
&file))
|
2016-10-03 13:04:58 -03:00
|
|
|
goto exit;
|
|
|
|
return_value = _testconsole_read_output_impl(module, file);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return return_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* defined(MS_WINDOWS) */
|
|
|
|
|
|
|
|
#ifndef _TESTCONSOLE_WRITE_INPUT_METHODDEF
|
|
|
|
#define _TESTCONSOLE_WRITE_INPUT_METHODDEF
|
|
|
|
#endif /* !defined(_TESTCONSOLE_WRITE_INPUT_METHODDEF) */
|
|
|
|
|
|
|
|
#ifndef _TESTCONSOLE_READ_OUTPUT_METHODDEF
|
|
|
|
#define _TESTCONSOLE_READ_OUTPUT_METHODDEF
|
|
|
|
#endif /* !defined(_TESTCONSOLE_READ_OUTPUT_METHODDEF) */
|
2024-03-21 13:45:43 -03:00
|
|
|
/*[clinic end generated code: output=d60ce07157e3741a input=a9049054013a1b77]*/
|