gh-137668: Document that ord() supports also bytes and bytearray (GH-137669)

This commit is contained in:
Serhiy Storchaka 2025-08-13 12:12:16 +03:00 committed by GitHub
parent 639df39bf0
commit 35759fe2fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 9 deletions

View file

@ -831,10 +831,16 @@ PyDoc_STRVAR(builtin_oct__doc__,
{"oct", (PyCFunction)builtin_oct, METH_O, builtin_oct__doc__},
PyDoc_STRVAR(builtin_ord__doc__,
"ord($module, c, /)\n"
"ord($module, character, /)\n"
"--\n"
"\n"
"Return the Unicode code point for a one-character string.");
"Return the ordinal value of a character.\n"
"\n"
"If the argument is a one-character string, return the Unicode code\n"
"point of that character.\n"
"\n"
"If the argument is a bytes or bytearray object of length 1, return its\n"
"single byte value.");
#define BUILTIN_ORD_METHODDEF \
{"ord", (PyCFunction)builtin_ord, METH_O, builtin_ord__doc__},
@ -1268,4 +1274,4 @@ builtin_issubclass(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
exit:
return return_value;
}
/*[clinic end generated code: output=e7a5d0851d7f2cfb input=a9049054013a1b77]*/
/*[clinic end generated code: output=cd5f80e3dc3082d5 input=a9049054013a1b77]*/