Skip to content

Commit c8c47f5

Browse files
committed
Merge heads.
2 parents 71f9633 + 8c85a20 commit c8c47f5

90 files changed

Lines changed: 966 additions & 683 deletions

Some content is hidden

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

Doc/c-api/buffer.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,15 +133,15 @@ a buffer, see :c:func:`PyObject_GetBuffer`.
133133
called on non-NULL :c:member:`~Py_buffer.format` values.
134134

135135
Important exception: If a consumer requests a buffer without the
136-
:c:macro:`PyBUF_FORMAT` flag, :c:member:`~Py_Buffer.format` will
136+
:c:macro:`PyBUF_FORMAT` flag, :c:member:`~Py_buffer.format` will
137137
be set to *NULL*, but :c:member:`~Py_buffer.itemsize` still has
138138
the value for the original format.
139139

140-
If :c:member:`~Py_Buffer.shape` is present, the equality
140+
If :c:member:`~Py_buffer.shape` is present, the equality
141141
``product(shape) * itemsize == len`` still holds and the consumer
142142
can use :c:member:`~Py_buffer.itemsize` to navigate the buffer.
143143

144-
If :c:member:`~Py_Buffer.shape` is *NULL* as a result of a :c:macro:`PyBUF_SIMPLE`
144+
If :c:member:`~Py_buffer.shape` is *NULL* as a result of a :c:macro:`PyBUF_SIMPLE`
145145
or a :c:macro:`PyBUF_WRITABLE` request, the consumer must disregard
146146
:c:member:`~Py_buffer.itemsize` and assume ``itemsize == 1``.
147147

@@ -156,7 +156,7 @@ a buffer, see :c:func:`PyObject_GetBuffer`.
156156
.. c:member:: int ndim
157157
158158
The number of dimensions the memory represents as an n-dimensional array.
159-
If it is 0, :c:member:`~Py_Buffer.buf` points to a single item representing
159+
If it is 0, :c:member:`~Py_buffer.buf` points to a single item representing
160160
a scalar. In this case, :c:member:`~Py_buffer.shape`, :c:member:`~Py_buffer.strides`
161161
and :c:member:`~Py_buffer.suboffsets` MUST be *NULL*.
162162

Doc/c-api/typeobj.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ type objects) *must* have the :attr:`ob_size` field.
9494
This field is not inherited by subtypes.
9595

9696

97-
.. c:member:: char* PyTypeObject.tp_name
97+
.. c:member:: const char* PyTypeObject.tp_name
9898
9999
Pointer to a NUL-terminated string containing the name of the type. For types
100100
that are accessible as module globals, the string should be the full module
@@ -372,7 +372,7 @@ type objects) *must* have the :attr:`ob_size` field.
372372
inherited individually.
373373

374374

375-
.. c:member:: long PyTypeObject.tp_flags
375+
.. c:member:: unsigned long PyTypeObject.tp_flags
376376
377377
This field is a bit mask of various flags. Some flags indicate variant
378378
semantics for certain situations; others are used to indicate that certain
@@ -472,7 +472,7 @@ type objects) *must* have the :attr:`ob_size` field.
472472
.. versionadded:: 3.4
473473

474474

475-
.. c:member:: char* PyTypeObject.tp_doc
475+
.. c:member:: const char* PyTypeObject.tp_doc
476476
477477
An optional pointer to a NUL-terminated C string giving the docstring for this
478478
type object. This is exposed as the :attr:`__doc__` attribute on the type and
@@ -619,7 +619,7 @@ type objects) *must* have the :attr:`ob_size` field.
619619
+----------------+------------+
620620

621621

622-
.. c:member:: long PyTypeObject.tp_weaklistoffset
622+
.. c:member:: Py_ssize_t PyTypeObject.tp_weaklistoffset
623623
624624
If the instances of this type are weakly referenceable, this field is greater
625625
than zero and contains the offset in the instance structure of the weak
@@ -786,7 +786,7 @@ type objects) *must* have the :attr:`ob_size` field.
786786
.. XXX explain.
787787
788788
789-
.. c:member:: long PyTypeObject.tp_dictoffset
789+
.. c:member:: Py_ssize_t PyTypeObject.tp_dictoffset
790790
791791
If the instances of this type have a dictionary containing instance variables,
792792
this field is non-zero and contains the offset in the instances of the type of

Doc/extending/newtypes.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -893,20 +893,20 @@ fields in the right order! It's often easiest to find an example that includes
893893
all the fields you need (even if they're initialized to ``0``) and then change
894894
the values to suit your new type. ::
895895

896-
char *tp_name; /* For printing */
896+
const char *tp_name; /* For printing */
897897

898898
The name of the type - as mentioned in the last section, this will appear in
899899
various places, almost entirely for diagnostic purposes. Try to choose something
900900
that will be helpful in such a situation! ::
901901

902-
int tp_basicsize, tp_itemsize; /* For allocation */
902+
Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */
903903

904904
These fields tell the runtime how much memory to allocate when new objects of
905905
this type are created. Python has some built-in support for variable length
906906
structures (think: strings, lists) which is where the :c:member:`~PyTypeObject.tp_itemsize` field
907907
comes in. This will be dealt with later. ::
908908

909-
char *tp_doc;
909+
const char *tp_doc;
910910

911911
Here you can put a string (or its address) that you want returned when the
912912
Python script references ``obj.__doc__`` to retrieve the doc string.

Doc/faq/programming.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,6 +1164,8 @@ analogue of lisp car is ``lisp_list[0]`` and the analogue of cdr is
11641164
usually a lot slower than using Python lists.
11651165

11661166

1167+
.. _faq-multidimensional-list:
1168+
11671169
How do I create a multidimensional list?
11681170
----------------------------------------
11691171

Doc/includes/typestruct.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
typedef struct _typeobject {
22
PyObject_VAR_HEAD
3-
char *tp_name; /* For printing, in format "<module>.<name>" */
4-
int tp_basicsize, tp_itemsize; /* For allocation */
3+
const char *tp_name; /* For printing, in format "<module>.<name>" */
4+
Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */
55

66
/* Methods to implement standard operations */
77

88
destructor tp_dealloc;
99
printfunc tp_print;
1010
getattrfunc tp_getattr;
1111
setattrfunc tp_setattr;
12-
PyAsyncMethods *tp_as_async;
12+
PyAsyncMethods *tp_as_async; /* formerly known as tp_compare (Python 2)
13+
or tp_reserved (Python 3) */
1314
reprfunc tp_repr;
1415

1516
/* Method suites for standard classes */
@@ -30,9 +31,9 @@ typedef struct _typeobject {
3031
PyBufferProcs *tp_as_buffer;
3132

3233
/* Flags to define presence of optional/expanded features */
33-
long tp_flags;
34+
unsigned long tp_flags;
3435

35-
char *tp_doc; /* Documentation string */
36+
const char *tp_doc; /* Documentation string */
3637

3738
/* call function for all accessible objects */
3839
traverseproc tp_traverse;
@@ -44,7 +45,7 @@ typedef struct _typeobject {
4445
richcmpfunc tp_richcompare;
4546

4647
/* weak reference enabler */
47-
long tp_weaklistoffset;
48+
Py_ssize_t tp_weaklistoffset;
4849

4950
/* Iterators */
5051
getiterfunc tp_iter;
@@ -58,7 +59,7 @@ typedef struct _typeobject {
5859
PyObject *tp_dict;
5960
descrgetfunc tp_descr_get;
6061
descrsetfunc tp_descr_set;
61-
long tp_dictoffset;
62+
Py_ssize_t tp_dictoffset;
6263
initproc tp_init;
6364
allocfunc tp_alloc;
6465
newfunc tp_new;
@@ -69,7 +70,6 @@ typedef struct _typeobject {
6970
PyObject *tp_cache;
7071
PyObject *tp_subclasses;
7172
PyObject *tp_weaklist;
72-
7373
destructor tp_del;
7474

7575
/* Type attribute cache version tag. Added in version 2.6 */

Doc/library/_thread.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ It defines the following constants and functions:
9393
Return the thread stack size used when creating new threads. The optional
9494
*size* argument specifies the stack size to be used for subsequently created
9595
threads, and must be 0 (use platform or configured default) or a positive
96-
integer value of at least 32,768 (32 KiB). If changing the thread stack size is
96+
integer value of at least 32,768 (32 KiB). If *size* is not specified,
97+
0 is used. If changing the thread stack size is
9798
unsupported, a :exc:`RuntimeError` is raised. If the specified stack size is
9899
invalid, a :exc:`ValueError` is raised and the stack size is unmodified. 32 KiB
99100
is currently the minimum supported stack size value to guarantee sufficient

Doc/library/asyncio-eventloop.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Base Event Loop
66
===============
77

88
The event loop is the central execution device provided by :mod:`asyncio`.
9-
It provides multiple facilities, amongst which:
9+
It provides multiple facilities, including:
1010

1111
* Registering, executing and cancelling delayed calls (timeouts).
1212

Doc/library/asyncio-subprocess.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ Process
303303
.. _asyncio-subprocess-threads:
304304

305305
Subprocess and threads
306-
======================
306+
----------------------
307307

308308
asyncio supports running subprocesses from different threads, but there
309309
are limits:
@@ -322,10 +322,10 @@ The :class:`asyncio.subprocess.Process` class is not thread safe.
322322

323323

324324
Subprocess examples
325-
===================
325+
-------------------
326326

327327
Subprocess using transport and protocol
328-
---------------------------------------
328+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
329329

330330
Example of a subprocess protocol using to get the output of a subprocess and to
331331
wait for the subprocess exit. The subprocess is created by the
@@ -381,7 +381,7 @@ wait for the subprocess exit. The subprocess is created by the
381381

382382

383383
Subprocess using streams
384-
------------------------
384+
^^^^^^^^^^^^^^^^^^^^^^^^
385385

386386
Example using the :class:`~asyncio.subprocess.Process` class to control the
387387
subprocess and the :class:`StreamReader` class to read from the standard

Doc/library/asyncio.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44
.. module:: asyncio
55
:synopsis: Asynchronous I/O, event loop, coroutines and tasks.
66

7+
.. note::
8+
9+
The asyncio package has been included in the standard library on a
10+
:term:`provisional basis <provisional package>`. Backwards incompatible
11+
changes (up to and including removal of the module) may occur if deemed
12+
necessary by the core developers.
13+
714
.. versionadded:: 3.4
815

916
**Source code:** :source:`Lib/asyncio/`

Doc/library/collections.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -842,10 +842,10 @@ field names, the method and attribute names start with an underscore.
842842
.. method:: somenamedtuple._asdict()
843843

844844
Return a new :class:`OrderedDict` which maps field names to their corresponding
845-
values. Note, this method is no longer needed now that the same effect can
846-
be achieved by using the built-in :func:`vars` function::
845+
values::
847846

848-
>>> vars(p)
847+
>>> p = Point(x=11, y=22)
848+
>>> p._asdict()
849849
OrderedDict([('x', 11), ('y', 22)])
850850

851851
.. versionchanged:: 3.1

0 commit comments

Comments
 (0)