Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8790a07

Browse files
committed
Fix #7579. Add docstrings to msvcrt and adjust some wording for bytes.
1 parent 1768999 commit 8790a07

2 files changed

Lines changed: 19 additions & 18 deletions

File tree

Doc/library/msvcrt.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -90,12 +90,12 @@ Console I/O
9090

9191
.. function:: getch()
9292

93-
Read a keypress and return the resulting character. Nothing is echoed to the
94-
console. This call will block if a keypress is not already available, but will
95-
not wait for :kbd:`Enter` to be pressed. If the pressed key was a special
96-
function key, this will return ``'\000'`` or ``'\xe0'``; the next call will
97-
return the keycode. The :kbd:`Control-C` keypress cannot be read with this
98-
function.
93+
Read a keypress and return the resulting character as a byte string.
94+
Nothing is echoed to the console. This call will block if a keypress
95+
is not already available, but will not wait for :kbd:`Enter` to be
96+
pressed. If the pressed key was a special function key, this will
97+
return ``'\000'`` or ``'\xe0'``; the next call will return the keycode.
98+
The :kbd:`Control-C` keypress cannot be read with this function.
9999

100100

101101
.. function:: getwch()
@@ -116,7 +116,7 @@ Console I/O
116116

117117
.. function:: putch(char)
118118

119-
Print the character *char* to the console without buffering.
119+
Print the byte string *char* to the console without buffering.
120120

121121

122122
.. function:: putwch(unicode_char)
@@ -126,8 +126,8 @@ Console I/O
126126

127127
.. function:: ungetch(char)
128128

129-
Cause the character *char* to be "pushed back" into the console buffer; it will
130-
be the next character read by :func:`getch` or :func:`getche`.
129+
Cause the byte string *char* to be "pushed back" into the console buffer;
130+
it will be the next character read by :func:`getch` or :func:`getche`.
131131

132132

133133
.. function:: ungetwch(unicode_char)

PC/msvcrtmodule.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,12 @@ msvcrt_getch(PyObject *self, PyObject *args)
197197
PyDoc_STRVAR(getch_doc,
198198
"getch() -> key character\n\
199199
\n\
200-
Read a keypress and return the resulting character. Nothing is echoed to\n\
201-
the console. This call will block if a keypress is not already\n\
202-
available, but will not wait for Enter to be pressed. If the pressed key\n\
203-
was a special function key, this will return '\\000' or '\\xe0'; the next\n\
204-
call will return the keycode. The Control-C keypress cannot be read with\n\
205-
this function.");
200+
Read a keypress and return the resulting character as a byte string.\n\
201+
Nothing is echoed to the console. This call will block if a keypress is\n\
202+
not already available, but will not wait for Enter to be pressed. If the\n\
203+
pressed key was a special function key, this will return '\\000' or\n\
204+
'\\xe0'; the next call will return the keycode. The Control-C keypress\n\
205+
cannot be read with this function.");
206206

207207
#ifdef _WCONIO_DEFINED
208208
static PyObject *
@@ -288,7 +288,7 @@ msvcrt_putch(PyObject *self, PyObject *args)
288288
PyDoc_STRVAR(putch_doc,
289289
"putch(char) -> None\n\
290290
\n\
291-
Print the character char to the console without buffering.");
291+
Print the byte string char to the console without buffering.");
292292

293293
#ifdef _WCONIO_DEFINED
294294
static PyObject *
@@ -327,8 +327,9 @@ msvcrt_ungetch(PyObject *self, PyObject *args)
327327
PyDoc_STRVAR(ungetch_doc,
328328
"ungetch(char) -> None\n\
329329
\n\
330-
Cause the character char to be \"pushed back\" into the console buffer;\n\
331-
it will be the next character read by getch() or getche().");
330+
Cause the byte string char to be \"pushed back\" into the\n\
331+
console buffer; it will be the next character read by\n\
332+
getch() or getche().");
332333

333334
#ifdef _WCONIO_DEFINED
334335
static PyObject *

0 commit comments

Comments
 (0)