diff options
author | AN Long <aisk@users.noreply.github.com> | 2023-09-12 22:44:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-12 15:44:48 +0100 |
commit | e121fca33bfb03a2d2bc33ba9d6bb5616d09b033 (patch) | |
tree | 336bc365eababfe2f96e6a5e80735dd1ce8f703e | |
parent | 42ab2cbd7b5e76e919b70883ae683e789dbd913d (diff) | |
download | cpython-e121fca33bfb03a2d2bc33ba9d6bb5616d09b033.tar.gz cpython-e121fca33bfb03a2d2bc33ba9d6bb5616d09b033.zip |
gh-109266: Fix msvcrt.kbhit's documented return value (GH-109267)
-rw-r--r-- | Doc/library/msvcrt.rst | 3 | ||||
-rw-r--r-- | PC/clinic/msvcrtmodule.c.h | 4 | ||||
-rw-r--r-- | PC/msvcrtmodule.c | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/Doc/library/msvcrt.rst b/Doc/library/msvcrt.rst index 32693e3d007..a24c037678d 100644 --- a/Doc/library/msvcrt.rst +++ b/Doc/library/msvcrt.rst @@ -98,7 +98,8 @@ Console I/O .. function:: kbhit() - Return ``True`` if a keypress is waiting to be read. + Returns a nonzero value if a keypress is waiting to be read. Otherwise, + return 0. .. function:: getch() diff --git a/PC/clinic/msvcrtmodule.c.h b/PC/clinic/msvcrtmodule.c.h index e2959a0fda1..54ae61bd4f1 100644 --- a/PC/clinic/msvcrtmodule.c.h +++ b/PC/clinic/msvcrtmodule.c.h @@ -201,7 +201,7 @@ PyDoc_STRVAR(msvcrt_kbhit__doc__, "kbhit($module, /)\n" "--\n" "\n" -"Return true if a keypress is waiting to be read."); +"Returns a nonzero value if a keypress is waiting to be read. Otherwise, return 0."); #define MSVCRT_KBHIT_METHODDEF \ {"kbhit", (PyCFunction)msvcrt_kbhit, METH_NOARGS, msvcrt_kbhit__doc__}, @@ -695,4 +695,4 @@ exit: #ifndef MSVCRT_GETERRORMODE_METHODDEF #define MSVCRT_GETERRORMODE_METHODDEF #endif /* !defined(MSVCRT_GETERRORMODE_METHODDEF) */ -/*[clinic end generated code: output=97e00f191821d4c0 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=525ec6ac4e3cb4f2 input=a9049054013a1b77]*/ diff --git a/PC/msvcrtmodule.c b/PC/msvcrtmodule.c index d7c21766d70..9a3462141bf 100644 --- a/PC/msvcrtmodule.c +++ b/PC/msvcrtmodule.c @@ -220,12 +220,12 @@ msvcrt_get_osfhandle_impl(PyObject *module, int fd) /*[clinic input] msvcrt.kbhit -> long -Return true if a keypress is waiting to be read. +Returns a nonzero value if a keypress is waiting to be read. Otherwise, return 0. [clinic start generated code]*/ static long msvcrt_kbhit_impl(PyObject *module) -/*[clinic end generated code: output=940dfce6587c1890 input=e70d678a5c2f6acc]*/ +/*[clinic end generated code: output=940dfce6587c1890 input=d0f4cb3289ff51e2]*/ { return _kbhit(); } |