mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Migrate to Sphinx 1.0 C language constructs.
This commit is contained in:
parent
64a41edb03
commit
60203b41b0
106 changed files with 2573 additions and 2569 deletions
|
@ -22,7 +22,7 @@ Conditional compilation
|
|||
=======================
|
||||
|
||||
The easiest way to compile only some code for 3.0 is to check if
|
||||
:cmacro:`PY_MAJOR_VERSION` is greater than or equal to 3. ::
|
||||
:c:macro:`PY_MAJOR_VERSION` is greater than or equal to 3. ::
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
#define IS_PY3K
|
||||
|
@ -47,12 +47,12 @@ Python 3.0's :func:`str` (``PyString_*`` functions in C) type is equivalent to
|
|||
2.x's :func:`unicode` (``PyUnicode_*``). The old 8-bit string type has become
|
||||
:func:`bytes`. Python 2.6 and later provide a compatibility header,
|
||||
:file:`bytesobject.h`, mapping ``PyBytes`` names to ``PyString`` ones. For best
|
||||
compatibility with 3.0, :ctype:`PyUnicode` should be used for textual data and
|
||||
:ctype:`PyBytes` for binary data. It's also important to remember that
|
||||
:ctype:`PyBytes` and :ctype:`PyUnicode` in 3.0 are not interchangeable like
|
||||
:ctype:`PyString` and :ctype:`PyString` are in 2.x. The following example shows
|
||||
best practices with regards to :ctype:`PyUnicode`, :ctype:`PyString`, and
|
||||
:ctype:`PyBytes`. ::
|
||||
c:ompatibility with 3.0, :c:type:`PyUnicode` should be used for textual data and
|
||||
:c:type:`PyBytes` for binary data. It's also important to remember that
|
||||
:c:type:`PyBytes` and :c:type:`PyUnicode` in 3.0 are not interchangeable like
|
||||
:c:type:`PyString` and :c:type:`PyString` are in 2.x. The following example shows
|
||||
best practices with regards to :c:type:`PyUnicode`, :c:type:`PyString`, and
|
||||
:c:type:`PyBytes`. ::
|
||||
|
||||
#include "stdlib.h"
|
||||
#include "Python.h"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue