Improve highlighting of some code blocks. (GH-6401)
(cherry picked from commit 46936d5a71d1683dbd8ddb6d7f39aab50ecfec50)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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 @@
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 @@
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 @@
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 @@
: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 @@
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 @@
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 @@
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 @@
: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 @@
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))