blob: e512fb172d7fc1c60002b0a5e390d5e6eabaf2fd [file] [log] [blame]
Steve Dower312cef72016-10-03 09:04:58 -07001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5#if defined(MS_WINDOWS)
6
7PyDoc_STRVAR(_testconsole_write_input__doc__,
8"write_input($module, /, file, s)\n"
9"--\n"
10"\n"
11"Writes UTF-16-LE encoded bytes to the console as if typed by a user.");
12
13#define _TESTCONSOLE_WRITE_INPUT_METHODDEF \
Serhiy Storchaka6969eaf2017-07-03 21:20:15 +030014 {"write_input", (PyCFunction)_testconsole_write_input, METH_FASTCALL|METH_KEYWORDS, _testconsole_write_input__doc__},
Steve Dower312cef72016-10-03 09:04:58 -070015
16static PyObject *
17_testconsole_write_input_impl(PyObject *module, PyObject *file,
18 PyBytesObject *s);
19
20static PyObject *
21_testconsole_write_input(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
22{
23 PyObject *return_value = NULL;
24 static const char * const _keywords[] = {"file", "s", NULL};
25 static _PyArg_Parser _parser = {"OS:write_input", _keywords, 0};
26 PyObject *file;
27 PyBytesObject *s;
28
Victor Stinner3e1fad62017-01-17 01:29:01 +010029 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
Steve Dower312cef72016-10-03 09:04:58 -070030 &file, &s)) {
31 goto exit;
32 }
33 return_value = _testconsole_write_input_impl(module, file, s);
34
35exit:
36 return return_value;
37}
38
39#endif /* defined(MS_WINDOWS) */
40
41#if defined(MS_WINDOWS)
42
43PyDoc_STRVAR(_testconsole_read_output__doc__,
44"read_output($module, /, file)\n"
45"--\n"
46"\n"
47"Reads a str from the console as written to stdout.");
48
49#define _TESTCONSOLE_READ_OUTPUT_METHODDEF \
Serhiy Storchaka6969eaf2017-07-03 21:20:15 +030050 {"read_output", (PyCFunction)_testconsole_read_output, METH_FASTCALL|METH_KEYWORDS, _testconsole_read_output__doc__},
Steve Dower312cef72016-10-03 09:04:58 -070051
52static PyObject *
53_testconsole_read_output_impl(PyObject *module, PyObject *file);
54
55static PyObject *
56_testconsole_read_output(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames)
57{
58 PyObject *return_value = NULL;
59 static const char * const _keywords[] = {"file", NULL};
60 static _PyArg_Parser _parser = {"O:read_output", _keywords, 0};
61 PyObject *file;
62
Victor Stinner3e1fad62017-01-17 01:29:01 +010063 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
Steve Dower312cef72016-10-03 09:04:58 -070064 &file)) {
65 goto exit;
66 }
67 return_value = _testconsole_read_output_impl(module, file);
68
69exit:
70 return return_value;
71}
72
73#endif /* defined(MS_WINDOWS) */
74
75#ifndef _TESTCONSOLE_WRITE_INPUT_METHODDEF
76 #define _TESTCONSOLE_WRITE_INPUT_METHODDEF
77#endif /* !defined(_TESTCONSOLE_WRITE_INPUT_METHODDEF) */
78
79#ifndef _TESTCONSOLE_READ_OUTPUT_METHODDEF
80 #define _TESTCONSOLE_READ_OUTPUT_METHODDEF
81#endif /* !defined(_TESTCONSOLE_READ_OUTPUT_METHODDEF) */
Serhiy Storchaka6969eaf2017-07-03 21:20:15 +030082/*[clinic end generated code: output=ac80ed19e6edc0af input=a9049054013a1b77]*/