Skip to content

Commit 872b44b

Browse files
committed
Merge remote-tracking branch 'origin/3.6' into intl-3.6
2 parents 41897b9 + 83bb399 commit 872b44b

File tree

81 files changed

+2303
-2145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+2303
-2145
lines changed

Doc/c-api/arg.rst

+22-5
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,35 @@ which disallows mutable objects such as :class:`bytearray`.
151151
Previously, :exc:`TypeError` was raised when embedded null code points
152152
were encountered in the Python string.
153153

154+
.. deprecated-removed:: 3.3 4.0
155+
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
156+
:c:func:`PyUnicode_AsWideCharString`.
157+
154158
``u#`` (:class:`str`) [Py_UNICODE \*, int]
155159
This variant on ``u`` stores into two C variables, the first one a pointer to a
156160
Unicode data buffer, the second one its length. This variant allows
157161
null code points.
158162

163+
.. deprecated-removed:: 3.3 4.0
164+
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
165+
:c:func:`PyUnicode_AsWideCharString`.
166+
159167
``Z`` (:class:`str` or ``None``) [Py_UNICODE \*]
160168
Like ``u``, but the Python object may also be ``None``, in which case the
161169
:c:type:`Py_UNICODE` pointer is set to *NULL*.
162170

171+
.. deprecated-removed:: 3.3 4.0
172+
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
173+
:c:func:`PyUnicode_AsWideCharString`.
174+
163175
``Z#`` (:class:`str` or ``None``) [Py_UNICODE \*, int]
164176
Like ``u#``, but the Python object may also be ``None``, in which case the
165177
:c:type:`Py_UNICODE` pointer is set to *NULL*.
166178

179+
.. deprecated-removed:: 3.3 4.0
180+
Part of the old-style :c:type:`Py_UNICODE` API; please migrate to using
181+
:c:func:`PyUnicode_AsWideCharString`.
182+
167183
``U`` (:class:`str`) [PyObject \*]
168184
Requires that the Python object is a Unicode object, without attempting
169185
any conversion. Raises :exc:`TypeError` if the object is not a Unicode
@@ -552,12 +568,13 @@ Building values
552568
``z#`` (:class:`str` or ``None``) [char \*, int]
553569
Same as ``s#``.
554570
555-
``u`` (:class:`str`) [Py_UNICODE \*]
556-
Convert a null-terminated buffer of Unicode (UCS-2 or UCS-4) data to a Python
557-
Unicode object. If the Unicode buffer pointer is *NULL*, ``None`` is returned.
571+
``u`` (:class:`str`) [wchar_t \*]
572+
Convert a null-terminated :c:type:`wchar_t` buffer of Unicode (UTF-16 or UCS-4)
573+
data to a Python Unicode object. If the Unicode buffer pointer is *NULL*,
574+
``None`` is returned.
558575
559-
``u#`` (:class:`str`) [Py_UNICODE \*, int]
560-
Convert a Unicode (UCS-2 or UCS-4) data buffer and its length to a Python
576+
``u#`` (:class:`str`) [wchar_t \*, int]
577+
Convert a Unicode (UTF-16 or UCS-4) data buffer and its length to a Python
561578
Unicode object. If the Unicode buffer pointer is *NULL*, the length is ignored
562579
and ``None`` is returned.
563580

Doc/distutils/configfile.rst

+16-6
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ consequences:
3636
* installers can override anything in :file:`setup.cfg` using the command-line
3737
options to :file:`setup.py`
3838

39-
The basic syntax of the configuration file is simple::
39+
The basic syntax of the configuration file is simple:
40+
41+
.. code-block:: ini
4042
4143
[command]
4244
option=value
@@ -51,9 +53,11 @@ option values can be split across multiple lines simply by indenting the
5153
continuation lines.
5254

5355
You can find out the list of options supported by a particular command with the
54-
universal :option:`!--help` option, e.g. ::
56+
universal :option:`!--help` option, e.g.
57+
58+
.. code-block:: shell-session
5559
56-
> python setup.py --help build_ext
60+
$ python setup.py --help build_ext
5761
[...]
5862
Options for 'build_ext' command:
5963
--build-lib (-b) directory for compiled extension modules
@@ -75,14 +79,18 @@ For example, say you want your extensions to be built "in-place"---that is, you
7579
have an extension :mod:`pkg.ext`, and you want the compiled extension file
7680
(:file:`ext.so` on Unix, say) to be put in the same source directory as your
7781
pure Python modules :mod:`pkg.mod1` and :mod:`pkg.mod2`. You can always use the
78-
:option:`!--inplace` option on the command-line to ensure this::
82+
:option:`!--inplace` option on the command-line to ensure this:
83+
84+
.. code-block:: sh
7985
8086
python setup.py build_ext --inplace
8187
8288
But this requires that you always specify the :command:`build_ext` command
8389
explicitly, and remember to provide :option:`!--inplace`. An easier way is to
8490
"set and forget" this option, by encoding it in :file:`setup.cfg`, the
85-
configuration file for this distribution::
91+
configuration file for this distribution:
92+
93+
.. code-block:: ini
8694
8795
[build_ext]
8896
inplace=1
@@ -103,7 +111,9 @@ information comes from the setup script, and some is automatically generated by
103111
the Distutils (such as the list of files installed). But some of it has to be
104112
supplied as options to :command:`bdist_rpm`, which would be very tedious to do
105113
on the command-line for every run. Hence, here is a snippet from the Distutils'
106-
own :file:`setup.cfg`::
114+
own :file:`setup.cfg`:
115+
116+
.. code-block:: ini
107117
108118
[bdist_rpm]
109119
release = 1

Doc/distutils/packageindex.rst

+6-2
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ The :command:`register` and :command:`upload` commands both check for the
156156
existence of a :file:`.pypirc` file at the location :file:`$HOME/.pypirc`.
157157
If this file exists, the command uses the username, password, and repository
158158
URL configured in the file. The format of a :file:`.pypirc` file is as
159-
follows::
159+
follows:
160+
161+
.. code-block:: ini
160162
161163
[distutils]
162164
index-servers =
@@ -179,7 +181,9 @@ Each section describing a repository defines three variables:
179181
will be prompt to type it when needed.
180182

181183
If you want to define another server a new section can be created and
182-
listed in the *index-servers* variable::
184+
listed in the *index-servers* variable:
185+
186+
.. code-block:: ini
183187
184188
[distutils]
185189
index-servers =

Doc/extending/embedding.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ options. In this case, the :mod:`sysconfig` module is a useful tool to
323323
programmatically extract the configuration values that you will want to
324324
combine together. For example:
325325

326-
.. code-block:: python
326+
.. code-block:: pycon
327327
328328
>>> import sysconfig
329329
>>> sysconfig.get_config_var('LIBS')

Doc/extending/extending.rst

+9-3
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ Let's create an extension module called ``spam`` (the favorite food of Monty
4242
Python fans...) and let's say we want to create a Python interface to the C
4343
library function :c:func:`system` [#]_. This function takes a null-terminated
4444
character string as argument and returns an integer. We want this function to
45-
be callable from Python as follows::
45+
be callable from Python as follows:
46+
47+
.. code-block:: pycon
4648
4749
>>> import spam
4850
>>> status = spam.system("ls -l")
@@ -438,7 +440,9 @@ part of the Python interpreter, you will have to change the configuration setup
438440
and rebuild the interpreter. Luckily, this is very simple on Unix: just place
439441
your file (:file:`spammodule.c` for example) in the :file:`Modules/` directory
440442
of an unpacked source distribution, add a line to the file
441-
:file:`Modules/Setup.local` describing your file::
443+
:file:`Modules/Setup.local` describing your file:
444+
445+
.. code-block:: sh
442446
443447
spam spammodule.o
444448
@@ -449,7 +453,9 @@ subdirectory, but then you must first rebuild :file:`Makefile` there by running
449453
:file:`Setup` file.)
450454

451455
If your module requires additional libraries to link with, these can be listed
452-
on the line in the configuration file as well, for instance::
456+
on the line in the configuration file as well, for instance:
457+
458+
.. code-block:: sh
453459
454460
spam spammodule.o -lX11
455461

Doc/extending/index.rst

+6-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ Recommended third party tools
2626
=============================
2727

2828
This guide only covers the basic tools for creating extensions provided
29-
as part of this version of CPython. Third party tools like Cython,
30-
``cffi``, SWIG and Numba offer both simpler and more sophisticated
31-
approaches to creating C and C++ extensions for Python.
29+
as part of this version of CPython. Third party tools like
30+
`Cython <http://cython.org/>`_, `cffi <https://cffi.readthedocs.io>`_,
31+
`SWIG <http://www.swig.org>`_ and `Numba <https://numba.pydata.org/>`_
32+
offer both simpler and more sophisticated approaches to creating C and C++
33+
extensions for Python.
3234

3335
.. seealso::
3436

@@ -52,6 +54,7 @@ C extensions.
5254
:numbered:
5355

5456
extending.rst
57+
newtypes_tutorial.rst
5558
newtypes.rst
5659
building.rst
5760
windows.rst

0 commit comments

Comments
 (0)