summaryrefslogtreecommitdiffstats
path: root/Doc/extending
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-07-29 01:49:37 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-07-29 01:49:37 (GMT)
commit6a09315ff098224da138ff708e470ebc1c0ba8ac (patch)
treee21713f5da3e25fa00aaf284c51273d2acde2884 /Doc/extending
parent10ea19f69c0bdb2c47aaa29c62dcb1f41825a3dc (diff)
parent1050d2d0c7730c6c533246bb2404937739a7775c (diff)
downloadcpython-6a09315ff098224da138ff708e470ebc1c0ba8ac.zip
cpython-6a09315ff098224da138ff708e470ebc1c0ba8ac.tar.gz
cpython-6a09315ff098224da138ff708e470ebc1c0ba8ac.tar.bz2
Issue #26462: Merge code block fixes from 3.5
Diffstat (limited to 'Doc/extending')
-rw-r--r--Doc/extending/building.rst9
-rw-r--r--Doc/extending/embedding.rst20
-rw-r--r--Doc/extending/extending.rst5
-rw-r--r--Doc/extending/newtypes.rst5
4 files changed, 25 insertions, 14 deletions
diff --git a/Doc/extending/building.rst b/Doc/extending/building.rst
index b5ccee7..9fe12c2 100644
--- a/Doc/extending/building.rst
+++ b/Doc/extending/building.rst
@@ -55,7 +55,9 @@ Since distutils also supports creation of binary packages, users don't
necessarily need a compiler and distutils to install the extension.
A distutils package contains a driver script, :file:`setup.py`. This is a plain
-Python file, which, in the most simple case, could look like this::
+Python file, which, in the most simple case, could look like this:
+
+.. code-block:: python3
from distutils.core import setup, Extension
@@ -96,7 +98,9 @@ file, :file:`demo.c`.
In many cases, building an extension is more complex, since additional
preprocessor defines and libraries may be needed. This is demonstrated in the
-example below. ::
+example below.
+
+.. code-block:: python3
from distutils.core import setup, Extension
@@ -161,4 +165,3 @@ commands can be used to do so. ::
python setup.py bdist_wininst
python setup.py bdist_rpm
python setup.py bdist_dumb
-
diff --git a/Doc/extending/embedding.rst b/Doc/extending/embedding.rst
index 1546b1a..ab2f616 100644
--- a/Doc/extending/embedding.rst
+++ b/Doc/extending/embedding.rst
@@ -157,7 +157,9 @@ script, such as:
c = c + b
return c
-then the result should be::
+then the result should be:
+
+.. code-block:: shell-session
$ call multiply multiply 3 2
Will compute 3 times 2
@@ -291,16 +293,20 @@ available). This script has several options, of which the following will
be directly useful to you:
* ``pythonX.Y-config --cflags`` will give you the recommended flags when
- compiling::
+ compiling:
+
+ .. code-block:: shell-session
- $ /opt/bin/python3.4-config --cflags
- -I/opt/include/python3.4m -I/opt/include/python3.4m -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
+ $ /opt/bin/python3.4-config --cflags
+ -I/opt/include/python3.4m -I/opt/include/python3.4m -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes
* ``pythonX.Y-config --ldflags`` will give you the recommended flags when
- linking::
+ linking:
+
+ .. code-block:: shell-session
- $ /opt/bin/python3.4-config --ldflags
- -L/opt/lib/python3.4/config-3.4m -lpthread -ldl -lutil -lm -lpython3.4m -Xlinker -export-dynamic
+ $ /opt/bin/python3.4-config --ldflags
+ -L/opt/lib/python3.4/config-3.4m -lpthread -ldl -lutil -lm -lpython3.4m -Xlinker -export-dynamic
.. note::
To avoid confusion between several Python installations (and especially
diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst
index 523dfab..8219707 100644
--- a/Doc/extending/extending.rst
+++ b/Doc/extending/extending.rst
@@ -792,7 +792,9 @@ the format string is empty, it returns ``None``; if it contains exactly one
format unit, it returns whatever object is described by that format unit. To
force it to return a tuple of size 0 or one, parenthesize the format string.
-Examples (to the left the call, to the right the resulting Python value)::
+Examples (to the left the call, to the right the resulting Python value):
+
+.. code-block:: none
Py_BuildValue("") None
Py_BuildValue("i", 123) 123
@@ -1348,4 +1350,3 @@ code distribution).
.. [#] These guarantees don't hold when you use the "old" style calling convention ---
this is still found in much existing code.
-
diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst
index f60e208..5a207e6 100644
--- a/Doc/extending/newtypes.rst
+++ b/Doc/extending/newtypes.rst
@@ -209,7 +209,9 @@ That's it! All that remains is to build it; put the above code in a file called
setup(name="noddy", version="1.0",
ext_modules=[Extension("noddy", ["noddy.c"])])
-in a file called :file:`setup.py`; then typing ::
+in a file called :file:`setup.py`; then typing
+
+.. code-block:: shell-session
$ python setup.py build
@@ -1513,4 +1515,3 @@ might be something like the following::
.. [#] Even in the third version, we aren't guaranteed to avoid cycles. Instances of
string subclasses are allowed and string subclasses could allow cycles even if
normal strings don't.
-