summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/init.rst40
-rw-r--r--Doc/c-api/object.rst73
-rw-r--r--Doc/c-api/typeobj.rst10
-rw-r--r--Doc/c-api/unicode.rst3
-rw-r--r--Doc/extending/newtypes.rst10
-rw-r--r--Doc/library/hashlib-blake2.rst22
-rw-r--r--Doc/library/io.rst21
-rw-r--r--Doc/library/logging.rst10
-rw-r--r--Doc/library/re.rst6
-rw-r--r--Doc/library/socket.rst12
-rw-r--r--Doc/library/stdtypes.rst12
-rw-r--r--Doc/library/subprocess.rst6
-rw-r--r--Doc/library/sys.rst9
-rw-r--r--Doc/library/timeit.rst35
-rw-r--r--Doc/library/zipfile.rst4
-rw-r--r--Doc/tools/susp-ignored.csv2
-rw-r--r--Doc/tools/templates/indexsidebar.html2
-rw-r--r--Doc/tutorial/interpreter.rst8
-rw-r--r--Doc/tutorial/stdlib.rst2
-rw-r--r--Doc/tutorial/stdlib2.rst2
-rw-r--r--Doc/whatsnew/3.7.rst142
-rw-r--r--Doc/whatsnew/index.rst1
22 files changed, 293 insertions, 139 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst
index 2965bc9..7d9eefb 100644
--- a/Doc/c-api/init.rst
+++ b/Doc/c-api/init.rst
@@ -1147,46 +1147,6 @@ Python-level trace functions in previous versions.
:c:func:`PyEval_SetProfile`, except the tracing function does receive line-number
events.
-.. c:function:: PyObject* PyEval_GetCallStats(PyObject *self)
-
- Return a tuple of function call counts. There are constants defined for the
- positions within the tuple:
-
- +-------------------------------+-------+
- | Name | Value |
- +===============================+=======+
- | :const:`PCALL_ALL` | 0 |
- +-------------------------------+-------+
- | :const:`PCALL_FUNCTION` | 1 |
- +-------------------------------+-------+
- | :const:`PCALL_FAST_FUNCTION` | 2 |
- +-------------------------------+-------+
- | :const:`PCALL_FASTER_FUNCTION`| 3 |
- +-------------------------------+-------+
- | :const:`PCALL_METHOD` | 4 |
- +-------------------------------+-------+
- | :const:`PCALL_BOUND_METHOD` | 5 |
- +-------------------------------+-------+
- | :const:`PCALL_CFUNCTION` | 6 |
- +-------------------------------+-------+
- | :const:`PCALL_TYPE` | 7 |
- +-------------------------------+-------+
- | :const:`PCALL_GENERATOR` | 8 |
- +-------------------------------+-------+
- | :const:`PCALL_OTHER` | 9 |
- +-------------------------------+-------+
- | :const:`PCALL_POP` | 10 |
- +-------------------------------+-------+
-
- :const:`PCALL_FAST_FUNCTION` means no argument tuple needs to be created.
- :const:`PCALL_FASTER_FUNCTION` means that the fast-path frame setup code is used.
-
- If there is a method call where the call can be optimized by changing
- the argument tuple and calling the function directly, it gets recorded
- twice.
-
- This function is only present if Python is compiled with :const:`CALL_PROFILE`
- defined.
.. _advanced-debugging:
diff --git a/Doc/c-api/object.rst b/Doc/c-api/object.rst
index b761c80..754dedc 100644
--- a/Doc/c-api/object.rst
+++ b/Doc/c-api/object.rst
@@ -244,63 +244,82 @@ Object Protocol
and ``0`` otherwise. This function always succeeds.
-.. c:function:: PyObject* PyObject_Call(PyObject *callable_object, PyObject *args, PyObject *kw)
+.. c:function:: PyObject* PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs)
- Call a callable Python object *callable_object*, with arguments given by the
- tuple *args*, and named arguments given by the dictionary *kw*. If no named
- arguments are needed, *kw* may be *NULL*. *args* must not be *NULL*, use an
- empty tuple if no arguments are needed. Returns the result of the call on
- success, or *NULL* on failure. This is the equivalent of the Python expression
- ``callable_object(*args, **kw)``.
+ Call a callable Python object *callable*, with arguments given by the
+ tuple *args*, and named arguments given by the dictionary *kwargs*.
+ *args* must not be *NULL*, use an empty tuple if no arguments are needed.
+ If no named arguments are needed, *kwargs* can be *NULL*.
-.. c:function:: PyObject* PyObject_CallObject(PyObject *callable_object, PyObject *args)
+ Returns the result of the call on success, or *NULL* on failure.
- Call a callable Python object *callable_object*, with arguments given by the
- tuple *args*. If no arguments are needed, then *args* may be *NULL*. Returns
- the result of the call on success, or *NULL* on failure. This is the equivalent
- of the Python expression ``callable_object(*args)``.
+ This is the equivalent of the Python expression:
+ ``callable(*args, **kwargs)``.
+
+
+.. c:function:: PyObject* PyObject_CallObject(PyObject *callable, PyObject *args)
+
+ Call a callable Python object *callable*, with arguments given by the
+ tuple *args*. If no arguments are needed, then *args* can be *NULL*.
+
+ Returns the result of the call on success, or *NULL* on failure.
+
+ This is the equivalent of the Python expression: ``callable(*args)``.
.. c:function:: PyObject* PyObject_CallFunction(PyObject *callable, const char *format, ...)
Call a callable Python object *callable*, with a variable number of C arguments.
The C arguments are described using a :c:func:`Py_BuildValue` style format
- string. The format may be *NULL*, indicating that no arguments are provided.
- Returns the result of the call on success, or *NULL* on failure. This is the
- equivalent of the Python expression ``callable(*args)``. Note that if you only
- pass :c:type:`PyObject \*` args, :c:func:`PyObject_CallFunctionObjArgs` is a
- faster alternative.
+ string. The format can be *NULL*, indicating that no arguments are provided.
+
+ Returns the result of the call on success, or *NULL* on failure.
+
+ This is the equivalent of the Python expression: ``callable(*args)``.
+
+ Note that if you only pass :c:type:`PyObject \*` args,
+ :c:func:`PyObject_CallFunctionObjArgs` is a faster alternative.
.. versionchanged:: 3.4
The type of *format* was changed from ``char *``.
-.. c:function:: PyObject* PyObject_CallMethod(PyObject *o, const char *method, const char *format, ...)
+.. c:function:: PyObject* PyObject_CallMethod(PyObject *obj, const char *name, const char *format, ...)
- Call the method named *method* of object *o* with a variable number of C
+ Call the method named *name* of object *obj* with a variable number of C
arguments. The C arguments are described by a :c:func:`Py_BuildValue` format
- string that should produce a tuple. The format may be *NULL*, indicating that
- no arguments are provided. Returns the result of the call on success, or *NULL*
- on failure. This is the equivalent of the Python expression ``o.method(args)``.
+ string that should produce a tuple.
+
+ The format can be *NULL*, indicating that no arguments are provided.
+
+ Returns the result of the call on success, or *NULL* on failure.
+
+ This is the equivalent of the Python expression:
+ ``obj.name(arg1, arg2, ...)``.
+
Note that if you only pass :c:type:`PyObject \*` args,
:c:func:`PyObject_CallMethodObjArgs` is a faster alternative.
.. versionchanged:: 3.4
- The types of *method* and *format* were changed from ``char *``.
+ The types of *name* and *format* were changed from ``char *``.
.. c:function:: PyObject* PyObject_CallFunctionObjArgs(PyObject *callable, ..., NULL)
Call a callable Python object *callable*, with a variable number of
:c:type:`PyObject\*` arguments. The arguments are provided as a variable number
- of parameters followed by *NULL*. Returns the result of the call on success, or
- *NULL* on failure.
+ of parameters followed by *NULL*.
+
+ Returns the result of the call on success, or *NULL* on failure.
+
+ This is the equivalent of the Python expression:
+ ``callable(arg1, arg2, ...)``.
-.. c:function:: PyObject* PyObject_CallMethodObjArgs(PyObject *o, PyObject *name, ..., NULL)
+.. c:function:: PyObject* PyObject_CallMethodObjArgs(PyObject *obj, PyObject *name, ..., NULL)
- Calls a method of the object *o*, where the name of the method is given as a
+ Calls a method of the Python object *obj*, where the name of the method is given as a
Python string object in *name*. It is called with a variable number of
:c:type:`PyObject\*` arguments. The arguments are provided as a variable number
of parameters followed by *NULL*. Returns the result of the call on success, or
diff --git a/Doc/c-api/typeobj.rst b/Doc/c-api/typeobj.rst
index ac6fd0b..2f0081a 100644
--- a/Doc/c-api/typeobj.rst
+++ b/Doc/c-api/typeobj.rst
@@ -727,11 +727,11 @@ type objects) *must* have the :attr:`ob_size` field.
typedef int (*setter)(PyObject *, PyObject *, void *);
typedef struct PyGetSetDef {
- char *name; /* attribute name */
- getter get; /* C function to get the attribute */
- setter set; /* C function to set or delete the attribute */
- char *doc; /* optional doc string */
- void *closure; /* optional additional data for getter and setter */
+ const char *name; /* attribute name */
+ getter get; /* C function to get the attribute */
+ setter set; /* C function to set or delete the attribute */
+ const char *doc; /* optional doc string */
+ void *closure; /* optional additional data for getter and setter */
} PyGetSetDef;
diff --git a/Doc/c-api/unicode.rst b/Doc/c-api/unicode.rst
index 02f7ada..a5d6c86 100644
--- a/Doc/c-api/unicode.rst
+++ b/Doc/c-api/unicode.rst
@@ -1605,6 +1605,9 @@ They all return *NULL* or ``-1`` if an exception occurs.
.. versionadded:: 3.3
+ .. versionchanged:: 3.7
+ *start* and *end* are now adjusted to behave like ``str[start:end]``.
+
.. c:function:: Py_ssize_t PyUnicode_Count(PyObject *str, PyObject *substr, \
Py_ssize_t start, Py_ssize_t end)
diff --git a/Doc/extending/newtypes.rst b/Doc/extending/newtypes.rst
index b8ce437..118f336 100644
--- a/Doc/extending/newtypes.rst
+++ b/Doc/extending/newtypes.rst
@@ -1138,11 +1138,11 @@ in the instance. A variety of primitive C types are supported, and access may
be read-only or read-write. The structures in the table are defined as::
typedef struct PyMemberDef {
- char *name;
- int type;
- int offset;
- int flags;
- char *doc;
+ const char *name;
+ int type;
+ int offset;
+ int flags;
+ const char *doc;
} PyMemberDef;
For each entry in the table, a :term:`descriptor` will be constructed and added to the
diff --git a/Doc/library/hashlib-blake2.rst b/Doc/library/hashlib-blake2.rst
index 436aa4f..1d28e06 100644
--- a/Doc/library/hashlib-blake2.rst
+++ b/Doc/library/hashlib-blake2.rst
@@ -3,8 +3,7 @@
:mod:`hashlib` --- BLAKE2 hash functions
========================================
-.. module:: hashlib
- :synopsis: BLAKE2 hash function for Python
+.. currentmodule:: hashlib
.. sectionauthor:: Dmitry Chestnykh
.. index::
@@ -26,9 +25,6 @@ Hash objects from this module follow the API of standard library's
:mod:`hashlib` objects.
-Module
-======
-
Creating hash objects
---------------------
@@ -138,10 +134,10 @@ Maximum digest size that the hash function can output.
Examples
-========
+--------
Simple hashing
---------------
+^^^^^^^^^^^^^^
To calculate hash of some data, you should first construct a hash object by
calling the appropriate constructor function (:func:`blake2b` or
@@ -176,7 +172,7 @@ update the hash:
Using different digest sizes
-----------------------------
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
BLAKE2 has configurable size of digests up to 64 bytes for BLAKE2b and up to 32
bytes for BLAKE2s. For example, to replace SHA-1 with BLAKE2b without changing
@@ -208,7 +204,7 @@ produce different outputs even if the output length is the same:
Keyed hashing
--------------
+^^^^^^^^^^^^^
Keyed hashing can be used for authentication as a faster and simpler
replacement for `Hash-based message authentication code
@@ -261,7 +257,7 @@ in HMAC construction with :mod:`hmac` module::
Randomized hashing
-------------------
+^^^^^^^^^^^^^^^^^^
By setting *salt* parameter users can introduce randomization to the hash
function. Randomized hashing is useful for protecting against collision attacks
@@ -317,7 +313,7 @@ initialization, rather than as an input to each compression function.
Personalization
----------------
+^^^^^^^^^^^^^^^
Sometimes it is useful to force hash function to produce different digests for
the same input for different purposes. Quoting the authors of the Skein hash
@@ -362,7 +358,7 @@ keys from a single one.
G9GtHFE1YluXY1zWPlYk1e/nWfu0WSEb0KRcjhDeP/o=
Tree mode
----------
+^^^^^^^^^
Here's an example of hashing a minimal tree with two leaf nodes::
@@ -400,7 +396,7 @@ digest::
'3ad2a9b37c6070e374c7a8c508fe20ca86b6ed54e286e93a0318e95e881db5aa'
Credits
-=======
+-------
BLAKE2_ was designed by *Jean-Philippe Aumasson*, *Samuel Neves*, *Zooko
Wilcox-O'Hearn*, and *Christian Winnerlein* based on SHA-3_ finalist BLAKE_
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index 4da6e09..c8ff5b8 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -477,7 +477,7 @@ I/O Base Classes
A :exc:`BlockingIOError` is raised if the underlying raw stream is in
non blocking-mode, and has no data available at the moment.
- .. method:: read1(size=-1)
+ .. method:: read1([size])
Read and return up to *size* bytes, with at most one call to the
underlying raw stream's :meth:`~RawIOBase.read` (or
@@ -485,6 +485,9 @@ I/O Base Classes
implementing your own buffering on top of a :class:`BufferedIOBase`
object.
+ If *size* is ``-1`` (the default), an arbitrary number of bytes are
+ returned (more than zero unless EOF is reached).
+
.. method:: readinto(b)
Read bytes into a pre-allocated, writable
@@ -628,13 +631,16 @@ than raw I/O does.
Return :class:`bytes` containing the entire contents of the buffer.
- .. method:: read1()
+ .. method:: read1([size])
+
+ In :class:`BytesIO`, this is the same as :meth:`~BufferedIOBase.read`.
- In :class:`BytesIO`, this is the same as :meth:`read`.
+ .. versionchanged:: 3.7
+ The *size* argument is now optional.
- .. method:: readinto1()
+ .. method:: readinto1(b)
- In :class:`BytesIO`, this is the same as :meth:`readinto`.
+ In :class:`BytesIO`, this is the same as :meth:`~BufferedIOBase.readinto`.
.. versionadded:: 3.5
@@ -664,12 +670,15 @@ than raw I/O does.
Read and return *size* bytes, or if *size* is not given or negative, until
EOF or if the read call would block in non-blocking mode.
- .. method:: read1(size)
+ .. method:: read1([size])
Read and return up to *size* bytes with only one call on the raw stream.
If at least one byte is buffered, only buffered bytes are returned.
Otherwise, one raw stream read call is made.
+ .. versionchanged:: 3.7
+ The *size* argument is now optional.
+
.. class:: BufferedWriter(raw, buffer_size=DEFAULT_BUFFER_SIZE)
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst
index 6098878..d03cc50 100644
--- a/Doc/library/logging.rst
+++ b/Doc/library/logging.rst
@@ -1023,7 +1023,7 @@ functions.
handlers being added multiple times to the root logger, which can in turn
lead to multiple messages for the same event.
-.. function:: disable(lvl)
+.. function:: disable(lvl=CRITICAL)
Provides an overriding level *lvl* for all loggers which takes precedence over
the logger's own level. When the need arises to temporarily throttle logging
@@ -1036,6 +1036,14 @@ functions.
overriding level, so that logging output again depends on the effective
levels of individual loggers.
+ Note that if you have defined any custom logging level higher than
+ ``CRITICAL`` (this is not recommended), you won't be able to rely on the
+ default value for the *lvl* parameter, but will have to explicitly supply a
+ suitable value.
+
+ .. versionchanged:: 3.7
+ The *lvl* parameter was defaulted to level ``CRITICAL``. See Issue
+ #28524 for more information about this change.
.. function:: addLevelName(lvl, levelName)
diff --git a/Doc/library/re.rst b/Doc/library/re.rst
index 7ef4cbe..adf3ddd 100644
--- a/Doc/library/re.rst
+++ b/Doc/library/re.rst
@@ -761,9 +761,9 @@ form.
Unknown escapes in *pattern* consisting of ``'\'`` and an ASCII letter
now are errors.
- .. deprecated-removed:: 3.5 3.7
- Unknown escapes in *repl* consisting of ``'\'`` and an ASCII letter now raise
- a deprecation warning and will be forbidden in Python 3.7.
+ .. versionchanged:: 3.7
+ Unknown escapes in *repl* consisting of ``'\'`` and an ASCII letter
+ now are errors.
.. function:: subn(pattern, repl, string, count=0, flags=0)
diff --git a/Doc/library/socket.rst b/Doc/library/socket.rst
index 9c10867..252b6db 100644
--- a/Doc/library/socket.rst
+++ b/Doc/library/socket.rst
@@ -664,6 +664,12 @@ The :mod:`socket` module also offers various network-related services:
where the host byte order is the same as network byte order, this is a no-op;
otherwise, it performs a 2-byte swap operation.
+ .. deprecated:: 3.7
+ In case *x* does not fit in 16-bit unsigned integer, but does fit in a
+ positive C int, it is silently truncated to 16-bit unsigned integer.
+ This silent truncation feature is deprecated, and will raise an
+ exception in future versions of Python.
+
.. function:: htonl(x)
@@ -678,6 +684,12 @@ The :mod:`socket` module also offers various network-related services:
where the host byte order is the same as network byte order, this is a no-op;
otherwise, it performs a 2-byte swap operation.
+ .. deprecated:: 3.7
+ In case *x* does not fit in 16-bit unsigned integer, but does fit in a
+ positive C int, it is silently truncated to 16-bit unsigned integer.
+ This silent truncation feature is deprecated, and will raise an
+ exception in future versions of Python.
+
.. function:: inet_aton(ip_string)
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index 9a4f42c..d13fc3d 100644
--- a/Doc/library/stdtypes.rst
+++ b/Doc/library/stdtypes.rst
@@ -2316,11 +2316,15 @@ the bytes type has an additional class method to read data in that format:
This :class:`bytes` class method returns a bytes object, decoding the
given string object. The string must contain two hexadecimal digits per
- byte, with ASCII spaces being ignored.
+ byte, with ASCII whitespace being ignored.
>>> bytes.fromhex('2Ef0 F1f2 ')
b'.\xf0\xf1\xf2'
+ .. versionchanged:: 3.7
+ :meth:`bytes.fromhex` now skips all ASCII whitespace in the string,
+ not just spaces.
+
A reverse conversion function exists to transform a bytes object into its
hexadecimal representation.
@@ -2384,11 +2388,15 @@ the bytearray type has an additional class method to read data in that format:
This :class:`bytearray` class method returns bytearray object, decoding
the given string object. The string must contain two hexadecimal digits
- per byte, with ASCII spaces being ignored.
+ per byte, with ASCII whitespace being ignored.
>>> bytearray.fromhex('2Ef0 F1f2 ')
bytearray(b'.\xf0\xf1\xf2')
+ .. versionchanged:: 3.7
+ :meth:`bytearray.fromhex` now skips all ASCII whitespace in the string,
+ not just spaces.
+
A reverse conversion function exists to transform a bytearray object into its
hexadecimal representation.
diff --git a/Doc/library/subprocess.rst b/Doc/library/subprocess.rst
index ad2abe8..ea065b8 100644
--- a/Doc/library/subprocess.rst
+++ b/Doc/library/subprocess.rst
@@ -608,12 +608,6 @@ Instances of the :class:`Popen` class have the following methods:
.. versionchanged:: 3.3
*timeout* was added.
- .. deprecated:: 3.4
-
- Do not use the *endtime* parameter. It is was unintentionally
- exposed in 3.3 but was left undocumented as it was intended to be
- private for internal use. Use *timeout* instead.
-
.. method:: Popen.communicate(input=None, timeout=None)
Interact with process: Send data to stdin. Read data from stdout and stderr,
diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst
index dd51ffd..54b99e0 100644
--- a/Doc/library/sys.rst
+++ b/Doc/library/sys.rst
@@ -404,6 +404,15 @@ always available.
.. versionadded:: 3.4
+.. function:: getandroidapilevel()
+
+ Return the build time API version of Android as an integer.
+
+ Availability: Android.
+
+ .. versionadded:: 3.7
+
+
.. function:: getcheckinterval()
Return the interpreter's "check interval"; see :func:`setcheckinterval`.
diff --git a/Doc/library/timeit.rst b/Doc/library/timeit.rst
index 3b77276..4065808 100644
--- a/Doc/library/timeit.rst
+++ b/Doc/library/timeit.rst
@@ -28,11 +28,11 @@ can be used to compare three different expressions:
.. code-block:: sh
$ python3 -m timeit '"-".join(str(n) for n in range(100))'
- 10000 loops, best of 3: 30.2 usec per loop
+ 10000 loops, best of 5: 30.2 usec per loop
$ python3 -m timeit '"-".join([str(n) for n in range(100)])'
- 10000 loops, best of 3: 27.5 usec per loop
+ 10000 loops, best of 5: 27.5 usec per loop
$ python3 -m timeit '"-".join(map(str, range(100)))'
- 10000 loops, best of 3: 23.2 usec per loop
+ 10000 loops, best of 5: 23.2 usec per loop
This can be achieved from the :ref:`python-interface` with::
@@ -141,9 +141,8 @@ The module defines three convenience functions and a public class:
This is a convenience function that calls :meth:`.timeit` repeatedly
so that the total time >= 0.2 second, returning the eventual
(number of loops, time taken for that number of loops). It calls
- :meth:`.timeit` with *number* set to successive powers of ten (10,
- 100, 1000, ...) up to a maximum of one billion, until the time taken
- is at least 0.2 second, or the maximum is reached.
+ :meth:`.timeit` with increasing numbers from the sequence 1, 2, 5,
+ 10, 20, 50, ... until the time taken is at least 0.2 second.
If *callback* is given and is not ``None``, it will be called after
each trial with two arguments: ``callback(number, time_taken)``.
@@ -197,7 +196,7 @@ Command-Line Interface
When called as a program from the command line, the following form is used::
- python -m timeit [-n N] [-r N] [-u U] [-s S] [-t] [-c] [-h] [statement ...]
+ python -m timeit [-n N] [-r N] [-u U] [-s S] [-h] [statement ...]
Where the following options are understood:
@@ -222,20 +221,12 @@ Where the following options are understood:
.. versionadded:: 3.3
-.. cmdoption:: -t, --time
-
- use :func:`time.time` (deprecated)
-
.. cmdoption:: -u, --unit=U
- specify a time unit for timer output; can select usec, msec, or sec
+ specify a time unit for timer output; can select nsec, usec, msec, or sec
.. versionadded:: 3.5
-.. cmdoption:: -c, --clock
-
- use :func:`time.clock` (deprecated)
-
.. cmdoption:: -v, --verbose
print raw timing results; repeat for more digits precision
@@ -276,9 +267,9 @@ It is possible to provide a setup statement that is executed only once at the be
.. code-block:: sh
$ python -m timeit -s 'text = "sample string"; char = "g"' 'char in text'
- 10000000 loops, best of 3: 0.0877 usec per loop
+ 5000000 loops, best of 5: 0.0877 usec per loop
$ python -m timeit -s 'text = "sample string"; char = "g"' 'text.find(char)'
- 1000000 loops, best of 3: 0.342 usec per loop
+ 1000000 loops, best of 5: 0.342 usec per loop
::
@@ -305,14 +296,14 @@ to test for missing and present object attributes:
.. code-block:: sh
$ python -m timeit 'try:' ' str.__bool__' 'except AttributeError:' ' pass'
- 100000 loops, best of 3: 15.7 usec per loop
+ 20000 loops, best of 5: 15.7 usec per loop
$ python -m timeit 'if hasattr(str, "__bool__"): pass'
- 100000 loops, best of 3: 4.26 usec per loop
+ 50000 loops, best of 5: 4.26 usec per loop
$ python -m timeit 'try:' ' int.__bool__' 'except AttributeError:' ' pass'
- 1000000 loops, best of 3: 1.43 usec per loop
+ 200000 loops, best of 5: 1.43 usec per loop
$ python -m timeit 'if hasattr(int, "__bool__"): pass'
- 100000 loops, best of 3: 2.23 usec per loop
+ 100000 loops, best of 5: 2.23 usec per loop
::
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index 5eb6f10..a0de10c 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -672,18 +672,22 @@ Command-line options
~~~~~~~~~~~~~~~~~~~~
.. cmdoption:: -l <zipfile>
+ --list <zipfile>
List files in a zipfile.
.. cmdoption:: -c <zipfile> <source1> ... <sourceN>
+ --create <zipfile> <source1> ... <sourceN>
Create zipfile from source files.
.. cmdoption:: -e <zipfile> <output_dir>
+ --extract <zipfile> <output_dir>
Extract zipfile into target directory.
.. cmdoption:: -t <zipfile>
+ --test <zipfile>
Test whether the zipfile is valid or not.
diff --git a/Doc/tools/susp-ignored.csv b/Doc/tools/susp-ignored.csv
index 96483c4..dc4c381 100644
--- a/Doc/tools/susp-ignored.csv
+++ b/Doc/tools/susp-ignored.csv
@@ -324,6 +324,4 @@ whatsnew/3.5,,::,>>> addr6 = ipaddress.IPv6Address('::1')
whatsnew/3.5,,:root,ERROR:root:exception
whatsnew/3.5,,:exception,ERROR:root:exception
whatsnew/changelog,,:version,import sys; I = version[:version.index(' ')]
-whatsnew/changelog,,:gz,": TarFile opened with external fileobj and ""w:gz"" mode didn't"
-whatsnew/changelog,,::,": Use ""127.0.0.1"" or ""::1"" instead of ""localhost"" as much as"
whatsnew/changelog,,`,"for readability (was ""`"")."
diff --git a/Doc/tools/templates/indexsidebar.html b/Doc/tools/templates/indexsidebar.html
index 413c0a7..72a4d7a 100644
--- a/Doc/tools/templates/indexsidebar.html
+++ b/Doc/tools/templates/indexsidebar.html
@@ -4,7 +4,7 @@
<ul>
<li><a href="https://docs.python.org/2.7/">{% trans %}Python 2.7 (stable){% endtrans %}</a></li>
<li><a href="https://docs.python.org/3.5/">{% trans %}Python 3.5 (stable){% endtrans %}</a></li>
- <li><a href="https://docs.python.org/3.7/">{% trans %}Python 3.7 (in development){% endtrans %}</a></li>
+ <li><a href="https://docs.python.org/3.6/">{% trans %}Python 3.6 (stable){% endtrans %}</a></li>
<li><a href="https://www.python.org/doc/versions/">{% trans %}Old versions{% endtrans %}</a></li>
</ul>
diff --git a/Doc/tutorial/interpreter.rst b/Doc/tutorial/interpreter.rst
index faf57a3..c97f5d8 100644
--- a/Doc/tutorial/interpreter.rst
+++ b/Doc/tutorial/interpreter.rst
@@ -10,13 +10,13 @@ Using the Python Interpreter
Invoking the Interpreter
========================
-The Python interpreter is usually installed as :file:`/usr/local/bin/python3.6`
+The Python interpreter is usually installed as :file:`/usr/local/bin/python3.7`
on those machines where it is available; putting :file:`/usr/local/bin` in your
Unix shell's search path makes it possible to start it by typing the command:
.. code-block:: text
- python3.6
+ python3.7
to the shell. [#]_ Since the choice of the directory where the interpreter lives
is an installation option, other places are possible; check with your local
@@ -98,8 +98,8 @@ before printing the first prompt:
.. code-block:: shell-session
- $ python3.6
- Python 3.6 (default, Sep 16 2015, 09:25:04)
+ $ python3.7
+ Python 3.7 (default, Sep 16 2015, 09:25:04)
[GCC 4.8.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst
index 1dd06c2..6ac29fc 100644
--- a/Doc/tutorial/stdlib.rst
+++ b/Doc/tutorial/stdlib.rst
@@ -15,7 +15,7 @@ operating system::
>>> import os
>>> os.getcwd() # Return the current working directory
- 'C:\\Python36'
+ 'C:\\Python37'
>>> os.chdir('/server/accesslogs') # Change current working directory
>>> os.system('mkdir today') # Run the command mkdir in the system shell
0
diff --git a/Doc/tutorial/stdlib2.rst b/Doc/tutorial/stdlib2.rst
index bf02c71..9947231 100644
--- a/Doc/tutorial/stdlib2.rst
+++ b/Doc/tutorial/stdlib2.rst
@@ -278,7 +278,7 @@ applications include caching objects that are expensive to create::
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
d['primary'] # entry was automatically removed
- File "C:/python36/lib/weakref.py", line 46, in __getitem__
+ File "C:/python37/lib/weakref.py", line 46, in __getitem__
o = self.data[key]()
KeyError: 'primary'
diff --git a/Doc/whatsnew/3.7.rst b/Doc/whatsnew/3.7.rst
new file mode 100644
index 0000000..0d19f25
--- /dev/null
+++ b/Doc/whatsnew/3.7.rst
@@ -0,0 +1,142 @@
+****************************
+ What's New In Python 3.7
+****************************
+
+:Release: |release|
+:Date: |today|
+
+.. Rules for maintenance:
+
+ * Anyone can add text to this document. Do not spend very much time
+ on the wording of your changes, because your text will probably
+ get rewritten to some degree.
+
+ * The maintainer will go through Misc/NEWS periodically and add
+ changes; it's therefore more important to add your changes to
+ Misc/NEWS than to this file.
+
+ * This is not a complete list of every single change; completeness
+ is the purpose of Misc/NEWS. Some changes I consider too small
+ or esoteric to include. If such a change is added to the text,
+ I'll just remove it. (This is another reason you shouldn't spend
+ too much time on writing your addition.)
+
+ * If you want to draw your new text to the attention of the
+ maintainer, add 'XXX' to the beginning of the paragraph or
+ section.
+
+ * It's OK to just add a fragmentary note about a change. For
+ example: "XXX Describe the transmogrify() function added to the
+ socket module." The maintainer will research the change and
+ write the necessary text.
+
+ * You can comment out your additions if you like, but it's not
+ necessary (especially when a final release is some months away).
+
+ * Credit the author of a patch or bugfix. Just the name is
+ sufficient; the e-mail address isn't necessary.
+
+ * It's helpful to add the bug/patch number as a comment:
+
+ XXX Describe the transmogrify() function added to the socket
+ module.
+ (Contributed by P.Y. Developer in :issue:`12345`.)
+
+ This saves the maintainer the effort of going through the Mercurial log
+ when researching a change.
+
+This article explains the new features in Python 3.7, compared to 3.6.
+
+For full details, see the :ref:`changelog <changelog>`.
+
+.. note::
+
+ Prerelease users should be aware that this document is currently in draft
+ form. It will be updated substantially as Python 3.7 moves towards release,
+ so it's worth checking back even after reading earlier versions.
+
+
+Summary -- Release highlights
+=============================
+
+.. This section singles out the most important changes in Python 3.7.
+ Brevity is key.
+
+
+.. PEP-sized items next.
+
+
+
+New Features
+============
+
+
+
+Other Language Changes
+======================
+
+* More than 255 arguments can now be passed to a function, and a function can
+ now have more than 255 parameters.
+ (Contributed by Serhiy Storchaka in :issue:`12844` and :issue:`18896`.)
+
+* :meth:`bytes.fromhex` and :meth:`bytearray.fromhex` now ignore all ASCII
+ whitespace, not only spaces.
+ (Contributed by Robert Xiao in :issue:`28927`.)
+
+
+New Modules
+===========
+
+* None yet.
+
+
+Improved Modules
+================
+
+
+Optimizations
+=============
+
+* Added two new opcodes: ``LOAD_METHOD`` and ``CALL_METHOD`` to avoid
+ instantiation of bound method objects for method calls, which results
+ in method calls being faster up to 20%.
+ (Contributed by Yury Selivanov and INADA Naoki in :issue:`26110`.)
+
+
+Build and C API Changes
+=======================
+
+* A full copy of libffi is no longer bundled for use when building the
+ :mod:`_ctypes <ctypes>` module on non-OSX UNIX platforms. An installed copy
+ of libffi is now required when building ``_ctypes`` on such platforms.
+ Contributed by Zachary Ware in :issue:`27979`.
+
+* The fields :c:member:`name` and :c:member:`doc` of structures
+ :c:type:`PyMemberDef`, :c:type:`PyGetSetDef`,
+ :c:type:`PyStructSequence_Field`, :c:type:`PyStructSequence_Desc`,
+ and :c:type:`wrapperbase` are now of type ``const char *`` rather of
+ ``char *``. (Contributed by Serhiy Storchaka in :issue:`28761`.)
+
+
+Deprecated
+==========
+
+
+
+Removed
+=======
+
+API and Feature Removals
+------------------------
+
+* Unknown escapes consisting of ``'\'`` and an ASCII letter in replacement
+ templates for :func:`re.sub` will now cause an error.
+
+
+Porting to Python 3.7
+=====================
+
+This section lists previously described changes and other bugfixes
+that may require changes to your code.
+
+
diff --git a/Doc/whatsnew/index.rst b/Doc/whatsnew/index.rst
index 7c92524..160b364 100644
--- a/Doc/whatsnew/index.rst
+++ b/Doc/whatsnew/index.rst
@@ -11,6 +11,7 @@ anyone wishing to stay up-to-date after a new release.
.. toctree::
:maxdepth: 2
+ 3.7.rst
3.6.rst
3.5.rst
3.4.rst