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

(cherry picked from commit 35759fe2fa)
This commit is contained in:
Serhiy Storchaka 2025-08-13 12:37:15 +03:00 committed by GitHub
parent 165532ccdb
commit 3a74d52584
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 9 deletions

View file

@ -1969,15 +1969,21 @@ builtin_oct(PyObject *module, PyObject *number)
/*[clinic input]
ord as builtin_ord
c: object
character as c: object
/
Return the Unicode code point for a one-character string.
Return the ordinal value of a character.
If the argument is a one-character string, return the Unicode code
point of that character.
If the argument is a bytes or bytearray object of length 1, return its
single byte value.
[clinic start generated code]*/
static PyObject *
builtin_ord(PyObject *module, PyObject *c)
/*[clinic end generated code: output=4fa5e87a323bae71 input=3064e5d6203ad012]*/
/*[clinic end generated code: output=4fa5e87a323bae71 input=98d38480432e1177]*/
{
long ord;
Py_ssize_t size;