]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-109266: Fix msvcrt.kbhit's documented return value (GH-109267)
authorAN Long <aisk@users.noreply.github.com>
Tue, 12 Sep 2023 14:44:48 +0000 (22:44 +0800)
committerGitHub <noreply@github.com>
Tue, 12 Sep 2023 14:44:48 +0000 (15:44 +0100)
Doc/library/msvcrt.rst
PC/clinic/msvcrtmodule.c.h
PC/msvcrtmodule.c

index 32693e3d007c0537a666df9c50b91775f40869e0..a24c037678de0c9af3f41e7b4ea0afd1db54e614 100644 (file)
@@ -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()
index e2959a0fda1c525b21798e477c88e0ab7b6cc5fe..54ae61bd4f10a950a7e51ee1992dee0d672b663f 100644 (file)
@@ -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]*/
index d7c21766d709a61216764c2fe03ad256d0ba9620..9a3462141bffbfaac43c5fbc9a62357a2578ec45 100644 (file)
@@ -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();
 }