summaryrefslogtreecommitdiffstats
path: root/Doc/extending
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2018-04-08 16:18:04 (GMT)
committerGitHub <noreply@github.com>2018-04-08 16:18:04 (GMT)
commit46936d5a71d1683dbd8ddb6d7f39aab50ecfec50 (patch)
tree1f51e69c1fbb9401516478b8866d01f1513644cb /Doc/extending
parent9265dd72e5ec1cfa5fcdb5be8ebffe1d9994bd4b (diff)
downloadcpython-46936d5a71d1683dbd8ddb6d7f39aab50ecfec50.zip
cpython-46936d5a71d1683dbd8ddb6d7f39aab50ecfec50.tar.gz
cpython-46936d5a71d1683dbd8ddb6d7f39aab50ecfec50.tar.bz2
Improve highlighting of some code blocks. (GH-6401)
Diffstat (limited to 'Doc/extending')
-rw-r--r--Doc/extending/embedding.rst2
-rw-r--r--Doc/extending/extending.rst12
-rw-r--r--Doc/extending/newtypes_tutorial.rst10
3 files changed, 15 insertions, 9 deletions
diff --git a/Doc/extending/embedding.rst b/Doc/extending/embedding.rst
index ab2f616..7e4fc19 100644
--- a/Doc/extending/embedding.rst
+++ b/Doc/extending/embedding.rst
@@ -323,7 +323,7 @@ options. In this case, the :mod:`sysconfig` module is a useful tool to
programmatically extract the configuration values that you will want to
combine together. For example:
-.. code-block:: python
+.. code-block:: pycon
>>> import sysconfig
>>> sysconfig.get_config_var('LIBS')
diff --git a/Doc/extending/extending.rst b/Doc/extending/extending.rst
index e02f783..82b689e 100644
--- a/Doc/extending/extending.rst
+++ b/Doc/extending/extending.rst
@@ -43,7 +43,9 @@ Let's create an extension module called ``spam`` (the favorite food of Monty
Python fans...) and let's say we want to create a Python interface to the C
library function :c:func:`system` [#]_. This function takes a null-terminated
character string as argument and returns an integer. We want this function to
-be callable from Python as follows::
+be callable from Python as follows:
+
+.. code-block:: pycon
>>> import spam
>>> status = spam.system("ls -l")
@@ -439,7 +441,9 @@ part of the Python interpreter, you will have to change the configuration setup
and rebuild the interpreter. Luckily, this is very simple on Unix: just place
your file (:file:`spammodule.c` for example) in the :file:`Modules/` directory
of an unpacked source distribution, add a line to the file
-:file:`Modules/Setup.local` describing your file::
+:file:`Modules/Setup.local` describing your file:
+
+.. code-block:: sh
spam spammodule.o
@@ -450,7 +454,9 @@ subdirectory, but then you must first rebuild :file:`Makefile` there by running
:file:`Setup` file.)
If your module requires additional libraries to link with, these can be listed
-on the line in the configuration file as well, for instance::
+on the line in the configuration file as well, for instance:
+
+.. code-block:: sh
spam spammodule.o -lX11
diff --git a/Doc/extending/newtypes_tutorial.rst b/Doc/extending/newtypes_tutorial.rst
index 5e05cf6..ac48637 100644
--- a/Doc/extending/newtypes_tutorial.rst
+++ b/Doc/extending/newtypes_tutorial.rst
@@ -117,7 +117,7 @@ field mentioned above. ::
The name of our type. This will appear in the default textual representation of
our objects and in some error messages, for example:
-.. code-block:: python
+.. code-block:: pycon
>>> "" + custom.Custom()
Traceback (most recent call last):
@@ -183,7 +183,7 @@ set to *NULL*. ::
This adds the type to the module dictionary. This allows us to create
:class:`Custom` instances by calling the :class:`Custom` class:
-.. code-block:: python
+.. code-block:: pycon
>>> import custom
>>> mycustom = custom.Custom()
@@ -655,7 +655,7 @@ Python has a :term:`cyclic garbage collector (GC) <garbage collection>` that
can identify unneeded objects even when their reference counts are not zero.
This can happen when objects are involved in cycles. For example, consider:
-.. code-block:: python
+.. code-block:: pycon
>>> l = []
>>> l.append(l)
@@ -672,7 +672,7 @@ Besides, in the second and third versions, we allowed subclassing
:class:`Custom`, and subclasses may add arbitrary attributes. For any of
those two reasons, :class:`Custom` objects can participate in cycles:
-.. code-block:: python
+.. code-block:: pycon
>>> import custom3
>>> class Derived(custom3.Custom): pass
@@ -796,7 +796,7 @@ built-in :class:`list` type. The new type will be completely compatible with
regular lists, but will have an additional :meth:`increment` method that
increases an internal counter:
-.. code-block:: python
+.. code-block:: pycon
>>> import sublist
>>> s = sublist.SubList(range(3))