diff options
author | Martin Panter <vadmium+py@gmail.com> | 2016-07-29 01:49:37 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2016-07-29 01:49:37 (GMT) |
commit | 6a09315ff098224da138ff708e470ebc1c0ba8ac (patch) | |
tree | e21713f5da3e25fa00aaf284c51273d2acde2884 /Doc/whatsnew | |
parent | 10ea19f69c0bdb2c47aaa29c62dcb1f41825a3dc (diff) | |
parent | 1050d2d0c7730c6c533246bb2404937739a7775c (diff) | |
download | cpython-6a09315ff098224da138ff708e470ebc1c0ba8ac.zip cpython-6a09315ff098224da138ff708e470ebc1c0ba8ac.tar.gz cpython-6a09315ff098224da138ff708e470ebc1c0ba8ac.tar.bz2 |
Issue #26462: Merge code block fixes from 3.5
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/2.3.rst | 13 | ||||
-rw-r--r-- | Doc/whatsnew/2.4.rst | 4 | ||||
-rw-r--r-- | Doc/whatsnew/2.7.rst | 5 | ||||
-rw-r--r-- | Doc/whatsnew/3.0.rst | 4 | ||||
-rw-r--r-- | Doc/whatsnew/3.2.rst | 35 | ||||
-rw-r--r-- | Doc/whatsnew/3.3.rst | 5 | ||||
-rw-r--r-- | Doc/whatsnew/3.5.rst | 4 |
7 files changed, 50 insertions, 20 deletions
diff --git a/Doc/whatsnew/2.3.rst b/Doc/whatsnew/2.3.rst index fe8368e..ebdae69 100644 --- a/Doc/whatsnew/2.3.rst +++ b/Doc/whatsnew/2.3.rst @@ -291,7 +291,9 @@ PEP 273: Importing Modules from ZIP Archives The new :mod:`zipimport` module adds support for importing modules from a ZIP- format archive. You don't need to import the module explicitly; it will be automatically imported if a ZIP archive's filename is added to ``sys.path``. -For example:: +For example: + +.. code-block:: shell-session amk@nyman:~/src/python$ unzip -l /tmp/example.zip Archive: /tmp/example.zip @@ -1761,7 +1763,9 @@ This returns an object containing all of the option values, and a list of strings containing the remaining arguments. Invoking the script with the various arguments now works as you'd expect it to. -Note that the length argument is automatically converted to an integer. :: +Note that the length argument is automatically converted to an integer. + +.. code-block:: shell-session $ ./python opt.py -i data arg1 <Values at 0x400cad4c: {'input': 'data', 'length': None}> @@ -1771,7 +1775,9 @@ Note that the length argument is automatically converted to an integer. :: [] $ -The help message is automatically generated for you:: +The help message is automatically generated for you: + +.. code-block:: shell-session $ ./python opt.py --help usage: opt.py [options] @@ -2078,4 +2084,3 @@ Michael Hudson, Chris Lambert, Detlef Lannert, Martin von Löwis, Andrew MacIntyre, Lalo Martins, Chad Netzer, Gustavo Niemeyer, Neal Norwitz, Hans Nowak, Chris Reedy, Francesco Ricciardi, Vinay Sajip, Neil Schemenauer, Roman Suzi, Jason Tishler, Just van Rossum. - diff --git a/Doc/whatsnew/2.4.rst b/Doc/whatsnew/2.4.rst index fb4558b..5fb52fe 100644 --- a/Doc/whatsnew/2.4.rst +++ b/Doc/whatsnew/2.4.rst @@ -1425,7 +1425,9 @@ specifying the :const:`doctest.REPORT_UDIFF` (unified diffs), print word Running the above function's tests with :const:`doctest.REPORT_UDIFF` specified, -you get the following output:: +you get the following output: + +.. code-block:: none ********************************************************************** File "t.py", line 15, in g diff --git a/Doc/whatsnew/2.7.rst b/Doc/whatsnew/2.7.rst index 702aeb4..86f0197 100644 --- a/Doc/whatsnew/2.7.rst +++ b/Doc/whatsnew/2.7.rst @@ -2290,7 +2290,9 @@ There is an existing data type already used for this, written in pure Python could cause a segmentation fault by taking a :c:type:`PyCObject` from module A and somehow substituting it for the :c:type:`PyCObject` in module B. Capsules know their own name, -and getting the pointer requires providing the name:: +and getting the pointer requires providing the name: + +.. code-block:: c void *vtable; @@ -2616,4 +2618,3 @@ The author would like to thank the following people for offering suggestions, corrections and assistance with various drafts of this article: Nick Coghlan, Philip Jenvey, Ryan Lovett, R. David Murray, Hugh Secker-Walker. - diff --git a/Doc/whatsnew/3.0.rst b/Doc/whatsnew/3.0.rst index f53e4f8..a3d3fad 100644 --- a/Doc/whatsnew/3.0.rst +++ b/Doc/whatsnew/3.0.rst @@ -117,7 +117,9 @@ You can also customize the separator between items, e.g.:: print("There are <", 2**32, "> possibilities!", sep="") -which produces:: +which produces: + +.. code-block:: none There are <4294967296> possibilities! diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst index 975b59d..66c2aec 100644 --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -160,6 +160,8 @@ each with their own argument patterns and help displays:: parser_m.add_argument('-c', '--course', type=int, required=True) parser_m.add_argument('-s', '--speed', type=int, default=0) +.. code-block:: shell-session + $ ./helm.py --help # top level help (launch and move) $ ./helm.py launch --help # help for launch options $ ./helm.py launch --missiles # set missiles=True and torpedos=False @@ -478,7 +480,9 @@ Some smaller changes made to the core Python language are: * The interpreter can now be started with a quiet option, ``-q``, to prevent the copyright and version information from being displayed in the interactive - mode. The option can be introspected using the :attr:`sys.flags` attribute:: + mode. The option can be introspected using the :attr:`sys.flags` attribute: + + .. code-block:: shell-session $ python -q >>> sys.flags @@ -573,7 +577,9 @@ Some smaller changes made to the core Python language are: by Benjamin Peterson in :issue:`8413`.) * Warnings are now easier to control using the :envvar:`PYTHONWARNINGS` - environment variable as an alternative to using ``-W`` at the command line:: + environment variable as an alternative to using ``-W`` at the command line: + + .. code-block:: shell-session $ export PYTHONWARNINGS='ignore::RuntimeWarning::,once::UnicodeWarning::' @@ -595,7 +601,9 @@ Some smaller changes made to the core Python language are: object ensures it closes the underlying operating system resource (usually, a file descriptor), the delay in deallocating the object could produce various issues, especially under Windows. Here is an example - of enabling the warning from the command line:: + of enabling the warning from the command line: + + .. code-block:: shell-session $ python -q -Wdefault >>> f = open("foo", "wb") @@ -1720,7 +1728,9 @@ names. test discovery can find tests within packages, locating any test importable from the top-level directory. The top-level directory can be specified with the `-t` option, a pattern for matching files with ``-p``, and a directory to - start discovery with ``-s``:: + start discovery with ``-s``: + + .. code-block:: shell-session $ python -m unittest discover -s my_proj_dir -p _test.py @@ -1895,7 +1905,9 @@ pydoc The :mod:`pydoc` module now provides a much-improved Web server interface, as well as a new command-line option ``-b`` to automatically open a browser window -to display that server:: +to display that server: + +.. code-block:: shell-session $ pydoc3.2 -b @@ -1998,7 +2010,9 @@ details of a given Python installation. '/Users/raymondhettinger/Library/Python/3.2/lib/python/site-packages' Conveniently, some of site's functionality is accessible directly from the -command-line:: +command-line: + +.. code-block:: shell-session $ python -m site --user-base /Users/raymondhettinger/.local @@ -2031,7 +2045,9 @@ seven named schemes used by :mod:`distutils`. Those include *posix_prefix*, * :func:`~sysconfig.get_config_vars` returns a dictionary of platform specific variables. -There is also a convenient command-line interface:: +There is also a convenient command-line interface: + +.. code-block:: doscon C:\Python32>python -m sysconfig Platform: "win32" @@ -2265,7 +2281,9 @@ turtledemo The demonstration code for the :mod:`turtle` module was moved from the *Demo* directory to main library. It includes over a dozen sample scripts with lively displays. Being on :attr:`sys.path`, it can now be run directly -from the command-line:: +from the command-line: + +.. code-block:: shell-session $ python -m turtledemo @@ -2701,4 +2719,3 @@ require changes to your code: * Due to the new :term:`GIL` implementation, :c:func:`PyEval_InitThreads()` cannot be called before :c:func:`Py_Initialize()` anymore. - diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst index 9220bc7..44c71e0 100644 --- a/Doc/whatsnew/3.3.rst +++ b/Doc/whatsnew/3.3.rst @@ -871,7 +871,9 @@ signal. Call :func:`faulthandler.enable` to install fault handlers for the :envvar:`PYTHONFAULTHANDLER` environment variable or by using :option:`-X` ``faulthandler`` command line option. -Example of a segmentation fault on Linux: :: +Example of a segmentation fault on Linux: + +.. code-block:: shell-session $ python -q -X faulthandler >>> import ctypes @@ -999,7 +1001,6 @@ byte of an invalid byte sequence. For example, ``b'\xff\n'.decode('gb2312', Incremental CJK codec encoders are no longer reset at each call to their encode() methods. For example:: - $ ./python -q >>> import codecs >>> encoder = codecs.getincrementalencoder('hz')('strict') >>> b''.join(encoder.encode(x) for x in '\u52ff\u65bd\u65bc\u4eba\u3002 Bye.') diff --git a/Doc/whatsnew/3.5.rst b/Doc/whatsnew/3.5.rst index 8fc2f6c..339dbb6 100644 --- a/Doc/whatsnew/3.5.rst +++ b/Doc/whatsnew/3.5.rst @@ -742,7 +742,9 @@ publicized, either at the time or since. With the new module, bundling your application is as simple as putting all the files, including a ``__main__.py`` file, into a directory ``myapp`` -and running:: +and running: + +.. code-block:: shell-session $ python -m zipapp myapp $ python myapp.pyz |