Skip to content

Commit 2306fcd

Browse files
committed
str->bytes is *encoding*
1 parent 276d8cd commit 2306fcd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Doc/extending/first-extension-module.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -391,10 +391,10 @@ There's a slight type mismatch here: Python's :py:class:`str` objects store
391391
Unicode text, but C strings are arrays of bytes.
392392
So, we'll need to *encode* the data, and we'll use the UTF-8 encoding for it.
393393
(UTF-8 might not always be correct for system commands, but it's what
394-
:py:meth:`str.decode` uses by default,
394+
:py:meth:`str.encode` uses by default,
395395
and the C API has special support for it.)
396396

397-
The function to decode a Python string into a UTF-8 buffer is named
397+
The function to encode a Python string into a UTF-8 buffer is named
398398
:c:func:`PyUnicode_AsUTF8` [#why-pyunicodeasutf8]_.
399399
Call it like this:
400400

0 commit comments

Comments
 (0)