• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*[clinic input]
2 preserve
3 [clinic start generated code]*/
4 
5 #if defined(MS_WINDOWS)
6 
7 PyDoc_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    \
14     {"write_input", (PyCFunction)(void(*)(void))_testconsole_write_input, METH_FASTCALL|METH_KEYWORDS, _testconsole_write_input__doc__},
15 
16 static PyObject *
17 _testconsole_write_input_impl(PyObject *module, PyObject *file,
18                               PyBytesObject *s);
19 
20 static PyObject *
_testconsole_write_input(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)21 _testconsole_write_input(PyObject *module, PyObject *const *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 = {NULL, _keywords, "write_input", 0};
26     PyObject *argsbuf[2];
27     PyObject *file;
28     PyBytesObject *s;
29 
30     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
31     if (!args) {
32         goto exit;
33     }
34     file = args[0];
35     if (!PyBytes_Check(args[1])) {
36         _PyArg_BadArgument("write_input", "argument 's'", "bytes", args[1]);
37         goto exit;
38     }
39     s = (PyBytesObject *)args[1];
40     return_value = _testconsole_write_input_impl(module, file, s);
41 
42 exit:
43     return return_value;
44 }
45 
46 #endif /* defined(MS_WINDOWS) */
47 
48 #if defined(MS_WINDOWS)
49 
50 PyDoc_STRVAR(_testconsole_read_output__doc__,
51 "read_output($module, /, file)\n"
52 "--\n"
53 "\n"
54 "Reads a str from the console as written to stdout.");
55 
56 #define _TESTCONSOLE_READ_OUTPUT_METHODDEF    \
57     {"read_output", (PyCFunction)(void(*)(void))_testconsole_read_output, METH_FASTCALL|METH_KEYWORDS, _testconsole_read_output__doc__},
58 
59 static PyObject *
60 _testconsole_read_output_impl(PyObject *module, PyObject *file);
61 
62 static PyObject *
_testconsole_read_output(PyObject * module,PyObject * const * args,Py_ssize_t nargs,PyObject * kwnames)63 _testconsole_read_output(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
64 {
65     PyObject *return_value = NULL;
66     static const char * const _keywords[] = {"file", NULL};
67     static _PyArg_Parser _parser = {NULL, _keywords, "read_output", 0};
68     PyObject *argsbuf[1];
69     PyObject *file;
70 
71     args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 1, 1, 0, argsbuf);
72     if (!args) {
73         goto exit;
74     }
75     file = args[0];
76     return_value = _testconsole_read_output_impl(module, file);
77 
78 exit:
79     return return_value;
80 }
81 
82 #endif /* defined(MS_WINDOWS) */
83 
84 #ifndef _TESTCONSOLE_WRITE_INPUT_METHODDEF
85     #define _TESTCONSOLE_WRITE_INPUT_METHODDEF
86 #endif /* !defined(_TESTCONSOLE_WRITE_INPUT_METHODDEF) */
87 
88 #ifndef _TESTCONSOLE_READ_OUTPUT_METHODDEF
89     #define _TESTCONSOLE_READ_OUTPUT_METHODDEF
90 #endif /* !defined(_TESTCONSOLE_READ_OUTPUT_METHODDEF) */
91 /*[clinic end generated code: output=dd8b093a91b62753 input=a9049054013a1b77]*/
92