Skip to content

Commit d7b13ae

Browse files
committed
Merge with 3.4
2 parents 46b3d9b + bbe738f commit d7b13ae

File tree

426 files changed

+44545
-41493
lines changed

Some content is hidden

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

426 files changed

+44545
-41493
lines changed

.hgignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ db_home
1818
platform$
1919
pyconfig.h$
2020
python$
21+
python.bat$
2122
python.exe$
2223
python-config$
2324
python-config.py$

.hgtouch

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
Python/importlib.h: Lib/importlib/_bootstrap.py Modules/_freeze_importlib.c
66

7+
Include/opcode.h: Lib/opcode.py Tools/scripts/generate_opcode_h.py
8+
79
Include/Python-ast.h: Parser/Python.asdl Parser/asdl.py Parser/asdl_c.py
810
Python/Python-ast.c: Include/Python-ast.h
911

Doc/README.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Python Documentation README
33

44
This directory contains the reStructuredText (reST) sources to the Python
55
documentation. You don't need to build them yourself, prebuilt versions are
6-
available at <https://docs.python.org/3.4/download.html>.
6+
available at <https://docs.python.org/dev/download.html>.
77

88
Documentation on authoring Python documentation, including information about
99
both style and markup, is available in the "Documenting Python" chapter of the

Doc/c-api/memory.rst

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ functions are thread-safe, the :term:`GIL <global interpreter lock>` does not
9292
need to be held.
9393

9494
The default raw memory block allocator uses the following functions:
95-
:c:func:`malloc`, :c:func:`realloc` and :c:func:`free`; call ``malloc(1)`` when
96-
requesting zero bytes.
95+
:c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`; call
96+
``malloc(1)`` (or ``calloc(1, 1)``) when requesting zero bytes.
9797

9898
.. versionadded:: 3.4
9999

@@ -106,6 +106,17 @@ requesting zero bytes.
106106
been initialized in any way.
107107
108108
109+
.. c:function:: void* PyMem_RawCalloc(size_t nelem, size_t elsize)
110+
111+
Allocates *nelem* elements each whose size in bytes is *elsize* and returns
112+
a pointer of type :c:type:`void\*` to the allocated memory, or *NULL* if the
113+
request fails. The memory is initialized to zeros. Requesting zero elements
114+
or elements of size zero bytes returns a distinct non-*NULL* pointer if
115+
possible, as if ``PyMem_RawCalloc(1, 1)`` had been called instead.
116+
117+
.. versionadded:: 3.5
118+
119+
109120
.. c:function:: void* PyMem_RawRealloc(void *p, size_t n)
110121
111122
Resizes the memory block pointed to by *p* to *n* bytes. The contents will
@@ -136,8 +147,8 @@ behavior when requesting zero bytes, are available for allocating and releasing
136147
memory from the Python heap.
137148
138149
The default memory block allocator uses the following functions:
139-
:c:func:`malloc`, :c:func:`realloc` and :c:func:`free`; call ``malloc(1)`` when
140-
requesting zero bytes.
150+
:c:func:`malloc`, :c:func:`calloc`, :c:func:`realloc` and :c:func:`free`; call
151+
``malloc(1)`` (or ``calloc(1, 1)``) when requesting zero bytes.
141152
142153
.. warning::
143154
@@ -152,6 +163,17 @@ requesting zero bytes.
152163
been called instead. The memory will not have been initialized in any way.
153164
154165
166+
.. c:function:: void* PyMem_Calloc(size_t nelem, size_t elsize)
167+
168+
Allocates *nelem* elements each whose size in bytes is *elsize* and returns
169+
a pointer of type :c:type:`void\*` to the allocated memory, or *NULL* if the
170+
request fails. The memory is initialized to zeros. Requesting zero elements
171+
or elements of size zero bytes returns a distinct non-*NULL* pointer if
172+
possible, as if ``PyMem_Calloc(1, 1)`` had been called instead.
173+
174+
.. versionadded:: 3.5
175+
176+
155177
.. c:function:: void* PyMem_Realloc(void *p, size_t n)
156178
157179
Resizes the memory block pointed to by *p* to *n* bytes. The contents will be
@@ -210,7 +232,7 @@ Customize Memory Allocators
210232
211233
.. versionadded:: 3.4
212234
213-
.. c:type:: PyMemAllocator
235+
.. c:type:: PyMemAllocatorEx
214236
215237
Structure used to describe a memory block allocator. The structure has
216238
four fields:
@@ -222,11 +244,19 @@ Customize Memory Allocators
222244
+----------------------------------------------------------+---------------------------------------+
223245
| ``void* malloc(void *ctx, size_t size)`` | allocate a memory block |
224246
+----------------------------------------------------------+---------------------------------------+
247+
| ``void* calloc(void *ctx, size_t nelem, size_t elsize)`` | allocate a memory block initialized |
248+
| | with zeros |
249+
+----------------------------------------------------------+---------------------------------------+
225250
| ``void* realloc(void *ctx, void *ptr, size_t new_size)`` | allocate or resize a memory block |
226251
+----------------------------------------------------------+---------------------------------------+
227252
| ``void free(void *ctx, void *ptr)`` | free a memory block |
228253
+----------------------------------------------------------+---------------------------------------+
229254
255+
.. versionchanged:: 3.5
256+
The :c:type:`PyMemAllocator` structure was renamed to
257+
:c:type:`PyMemAllocatorEx` and a new ``calloc`` field was added.
258+
259+
230260
.. c:type:: PyMemAllocatorDomain
231261
232262
Enum used to identify an allocator domain. Domains:
@@ -239,12 +269,12 @@ Customize Memory Allocators
239269
:c:func:`PyObject_Realloc` and :c:func:`PyObject_Free`
240270
241271
242-
.. c:function:: void PyMem_GetAllocator(PyMemAllocatorDomain domain, PyMemAllocator *allocator)
272+
.. c:function:: void PyMem_GetAllocator(PyMemAllocatorDomain domain, PyMemAllocatorEx *allocator)
243273
244274
Get the memory block allocator of the specified domain.
245275
246276
247-
.. c:function:: void PyMem_SetAllocator(PyMemAllocatorDomain domain, PyMemAllocator *allocator)
277+
.. c:function:: void PyMem_SetAllocator(PyMemAllocatorDomain domain, PyMemAllocatorEx *allocator)
248278
249279
Set the memory block allocator of the specified domain.
250280

Doc/c-api/number.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ Number Protocol
3030
the equivalent of the Python expression ``o1 * o2``.
3131
3232
33+
.. c:function:: PyObject* PyNumber_MatrixMultiply(PyObject *o1, PyObject *o2)
34+
35+
Returns the result of matrix multiplication on *o1* and *o2*, or *NULL* on
36+
failure. This is the equivalent of the Python expression ``o1 @ o2``.
37+
38+
.. versionadded:: 3.5
39+
40+
3341
.. c:function:: PyObject* PyNumber_FloorDivide(PyObject *o1, PyObject *o2)
3442
3543
Return the floor of *o1* divided by *o2*, or *NULL* on failure. This is
@@ -146,6 +154,15 @@ Number Protocol
146154
the Python statement ``o1 *= o2``.
147155
148156
157+
.. c:function:: PyObject* PyNumber_InPlaceMatrixMultiply(PyObject *o1, PyObject *o2)
158+
159+
Returns the result of matrix multiplication on *o1* and *o2*, or *NULL* on
160+
failure. The operation is done *in-place* when *o1* supports it. This is
161+
the equivalent of the Python statement ``o1 @= o2``.
162+
163+
.. versionadded:: 3.5
164+
165+
149166
.. c:function:: PyObject* PyNumber_InPlaceFloorDivide(PyObject *o1, PyObject *o2)
150167
151168
Returns the mathematical floor of dividing *o1* by *o2*, or *NULL* on failure.

Doc/c-api/typeobj.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,9 @@ Number Object Structures
11411141
binaryfunc nb_inplace_true_divide;
11421142

11431143
unaryfunc nb_index;
1144+
1145+
binaryfunc nb_matrix_multiply;
1146+
binaryfunc nb_inplace_matrix_multiply;
11441147
} PyNumberMethods;
11451148

11461149
.. note::

Doc/distutils/apiref.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,13 +1099,13 @@ other utility module.
10991099
during the build of Python), not the OS version of the current system.
11001100

11011101
For universal binary builds on Mac OS X the architecture value reflects
1102-
the univeral binary status instead of the architecture of the current
1102+
the universal binary status instead of the architecture of the current
11031103
processor. For 32-bit universal binaries the architecture is ``fat``,
11041104
for 64-bit universal binaries the architecture is ``fat64``, and
11051105
for 4-way universal binaries the architecture is ``universal``. Starting
11061106
from Python 2.7 and Python 3.2 the architecture ``fat3`` is used for
11071107
a 3-way universal build (ppc, i386, x86_64) and ``intel`` is used for
1108-
a univeral build with the i386 and x86_64 architectures
1108+
a universal build with the i386 and x86_64 architectures
11091109

11101110
Examples of returned values on Mac OS X:
11111111

Doc/distutils/builtdist.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ support this option, so the command::
355355
would create a 64bit installation executable on your 32bit version of Windows.
356356

357357
To cross-compile, you must download the Python source code and cross-compile
358-
Python itself for the platform you are targetting - it is not possible from a
358+
Python itself for the platform you are targeting - it is not possible from a
359359
binary installation of Python (as the .lib etc file for other platforms are
360360
not included.) In practice, this means the user of a 32 bit operating
361361
system will need to use Visual Studio 2008 to open the

Doc/glossary.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -444,12 +444,13 @@ Glossary
444444

445445
A number of tools in Python accept key functions to control how elements
446446
are ordered or grouped. They include :func:`min`, :func:`max`,
447-
:func:`sorted`, :meth:`list.sort`, :func:`heapq.nsmallest`,
448-
:func:`heapq.nlargest`, and :func:`itertools.groupby`.
447+
:func:`sorted`, :meth:`list.sort`, :func:`heapq.merge`,
448+
:func:`heapq.nsmallest`, :func:`heapq.nlargest`, and
449+
:func:`itertools.groupby`.
449450

450451
There are several ways to create a key function. For example. the
451452
:meth:`str.lower` method can serve as a key function for case insensitive
452-
sorts. Alternatively, an ad-hoc key function can be built from a
453+
sorts. Alternatively, a key function can be built from a
453454
:keyword:`lambda` expression such as ``lambda r: (r[0], r[2])``. Also,
454455
the :mod:`operator` module provides three key function constructors:
455456
:func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and

Doc/howto/clinic.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ Argument Clinic generates code that does it for you (in the parsing function).
886886
Advanced converters
887887
-------------------
888888

889-
Remeber those format units you skipped for your first
889+
Remember those format units you skipped for your first
890890
time because they were advanced? Here's how to handle those too.
891891

892892
The trick is, all those format units take arguments--either
@@ -1020,12 +1020,12 @@ any of the default arguments you can omit the parentheses.
10201020
the ``"as"`` should come before the return converter.)
10211021

10221022
There's one additional complication when using return converters: how do you
1023-
indicate an error has occured? Normally, a function returns a valid (non-``NULL``)
1023+
indicate an error has occurred? Normally, a function returns a valid (non-``NULL``)
10241024
pointer for success, and ``NULL`` for failure. But if you use an integer return converter,
10251025
all integers are valid. How can Argument Clinic detect an error? Its solution: each return
10261026
converter implicitly looks for a special value that indicates an error. If you return
10271027
that value, and an error has been set (``PyErr_Occurred()`` returns a true
1028-
value), then the generated code will propogate the error. Otherwise it will
1028+
value), then the generated code will propagate the error. Otherwise it will
10291029
encode the value you return like normal.
10301030

10311031
Currently Argument Clinic supports only a few return converters::
@@ -1573,7 +1573,7 @@ The fourth new directive is ``set``::
15731573
``line_prefix`` is a string that will be prepended to every line of Clinic's output;
15741574
``line_suffix`` is a string that will be appended to every line of Clinic's output.
15751575

1576-
Both of these suport two format strings:
1576+
Both of these support two format strings:
15771577

15781578
``{block comment start}``
15791579
Turns into the string ``/*``, the start-comment text sequence for C files.

0 commit comments

Comments
 (0)