diff options
author | Łukasz Langa <lukasz@langa.pl> | 2020-10-04 17:31:29 (GMT) |
---|---|---|
committer | Łukasz Langa <lukasz@langa.pl> | 2020-10-05 15:07:58 (GMT) |
commit | 9cf6752276e6fcfd0c23fdb064ad27f448aaaf75 (patch) | |
tree | 90c732ba12fa75d4e19e361a3b4a6686ed0428be | |
parent | e8165e79f57cb3ca60bf031c417f8fd20c99eaa2 (diff) | |
download | cpython-9cf6752276e6fcfd0c23fdb064ad27f448aaaf75.zip cpython-9cf6752276e6fcfd0c23fdb064ad27f448aaaf75.tar.gz cpython-9cf6752276e6fcfd0c23fdb064ad27f448aaaf75.tar.bz2 |
Python 3.9.0v3.9.0
-rw-r--r-- | Doc/whatsnew/3.9.rst | 364 | ||||
-rw-r--r-- | Include/patchlevel.h | 6 | ||||
-rw-r--r-- | Lib/pydoc_data/topics.py | 1029 | ||||
-rw-r--r-- | Misc/NEWS.d/3.9.0.rst | 57 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Build/2020-09-28-21-56-51.bpo-38249.uzMCaZ.rst | 2 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2020-02-24-10-58-34.bpo-39728.kOOaHn.rst | 1 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2020-08-29-16-07-36.bpo-41662.Mn79zh.rst | 1 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2020-08-30-21-38-57.bpo-41662.6e9iZn.rst | 2 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2020-09-19-23-14-54.bpo-41815.RNpuX3.rst | 2 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Tests/2020-08-25-19-25-36.bpo-41602.Z64s0I.rst | 1 | ||||
-rw-r--r-- | README.rst | 4 |
11 files changed, 911 insertions, 558 deletions
diff --git a/Doc/whatsnew/3.9.rst b/Doc/whatsnew/3.9.rst index 95188b7..9a09e71 100644 --- a/Doc/whatsnew/3.9.rst +++ b/Doc/whatsnew/3.9.rst @@ -4,22 +4,21 @@ :Release: |release| :Date: |today| +:Editor: Łukasz Langa .. 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. + * Anyone can add text to this document. Your text might 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 + is the purpose of Misc/NEWS. Some changes will be 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.) + it might get removed during final editing. * If you want to draw your new text to the attention of the maintainer, add 'XXX' to the beginning of the paragraph or @@ -46,14 +45,13 @@ when researching a change. This article explains the new features in Python 3.9, compared to 3.8. +Python 3.9 was released on October 5th, 2020. For full details, see the :ref:`changelog <changelog>`. -.. note:: +.. seealso:: - Prerelease users should be aware that this document is currently in draft - form. It will be updated substantially as Python 3.9 moves towards release, - so it's worth checking back even after reading earlier versions. + :pep:`596` - Python 3.9 Release Schedule Summary -- Release highlights @@ -62,27 +60,70 @@ Summary -- Release highlights .. This section singles out the most important changes in Python 3.9. Brevity is key. +New syntax features: + +* :pep:`584`, union operators added to ``dict``; +* :pep:`585`, type hinting generics in standard collections; +* :pep:`614`, relaxed grammar restrictions on decorators. + +New built-in features: + +* :pep:`616`, string methods to remove prefixes and suffixes. + +New features in the standard library: + +* :pep:`593`, flexible function and variable annotations; +* :func:`os.pidfd_open` added that allows process management without races + and signals. + +Interpreter improvements: + +* :pep:`573`, fast access to module state from methods of C extension + types; +* :pep:`617`, CPython now uses a new parser based on PEG; +* a number of Python builtins (range, tuple, set, frozenset, list, dict) are + now sped up using :pep:`590` vectorcall; +* garbage collection does not block on resurrected objects; +* a number of Python modules (:mod:`_abc`, :mod:`audioop`, :mod:`_bz2`, + :mod:`_codecs`, :mod:`_contextvars`, :mod:`_crypt`, :mod:`_functools`, + :mod:`_json`, :mod:`_locale`, :mod:`math`, :mod:`operator`, :mod:`resource`, + :mod:`time`, :mod:`_weakref`) now use multiphase initialization as defined + by PEP 489; +* a number of standard library modules (:mod:`audioop`, :mod:`ast`, :mod:`grp`, + :mod:`_hashlib`, :mod:`pwd`, :mod:`_posixsubprocess`, :mod:`random`, + :mod:`select`, :mod:`struct`, :mod:`termios`, :mod:`zlib`) are now using + the stable ABI defined by PEP 384. -.. PEP-sized items next. +New library modules: + +* :pep:`615`, the IANA Time Zone Database is now present in the standard + library in the :mod:`zoneinfo` module; +* an implementation of a topological sort of a graph is now provided in + the new :mod:`graphlib` module. + +Release process changes: + +* :pep:`602`, CPython adopts an annual release cycle. You should check for DeprecationWarning in your code ==================================================== -When Python 2.7 was still supported, many functions were kept for backward -compatibility with Python 2.7. With the end of Python 2.7 support, these -backward compatibility layers have been removed, or will be removed soon. -Most of them emitted a :exc:`DeprecationWarning` warning for several years. For -example, using ``collections.Mapping`` instead of ``collections.abc.Mapping`` -emits a :exc:`DeprecationWarning` since Python 3.3, released in 2012. +When Python 2.7 was still supported, a lot of functionality in Python 3 +was kept for backward compatibility with Python 2.7. With the end of Python +2 support, these backward compatibility layers have been removed, or will +be removed soon. Most of them emitted a :exc:`DeprecationWarning` warning for +several years. For example, using ``collections.Mapping`` instead of +``collections.abc.Mapping`` emits a :exc:`DeprecationWarning` since Python +3.3, released in 2012. Test your application with the :option:`-W` ``default`` command-line option to see :exc:`DeprecationWarning` and :exc:`PendingDeprecationWarning`, or even with :option:`-W` ``error`` to treat them as errors. :ref:`Warnings Filter <warning-filter>` can be used to ignore warnings from third-party code. -It has been decided to keep a few backward compatibility layers for one last -release, to give more time to Python projects maintainers to organize the +Python 3.9 is the last version providing those Python 2 backward compatibility +layers, to give more time to Python projects maintainers to organize the removal of the Python 2 support and add support for Python 3.9. Aliases to :ref:`Abstract Base Classes <collections-abstract-base-classes>` in @@ -94,6 +135,9 @@ More generally, try to run your tests in the :ref:`Python Development Mode <devmode>` which helps to prepare your code to make it compatible with the next Python version. +Note: a number of pre-existing deprecatations were removed in this version +of Python as well. Consult the :ref:`removed-in-python-39` section. + New Features ============ @@ -102,11 +146,23 @@ Dictionary Merge & Update Operators ----------------------------------- Merge (``|``) and update (``|=``) operators have been added to the built-in -:class:`dict` class. See :pep:`584` for a full description. +:class:`dict` class. Those complement the existing ``dict.update`` and +``{**d1, **d2}`` methods of merging dictionaries. + +Example:: + + >>> x = {"key1": "value1 from x", "key2": "value2 from x"} + >>> y = {"key2": "value2 from y", "key3": "value3 from y"} + >>> x | y + {'key1': 'value1 from x', 'key2': 'value2 from y', 'key3': 'value3 from y'} + >>> y | x + {'key2': 'value2 from x', 'key3': 'value3 from y', 'key1': 'value1 from x'} + +See :pep:`584` for a full description. (Contributed by Brandt Bucher in :issue:`36144`.) -PEP 616: New removeprefix() and removesuffix() string methods -------------------------------------------------------------- +New String Methods to Remove Prefixes and Suffixes +-------------------------------------------------- :meth:`str.removeprefix(prefix)<str.removeprefix>` and :meth:`str.removesuffix(suffix)<str.removesuffix>` have been added @@ -115,8 +171,8 @@ to easily remove an unneeded prefix or a suffix from a string. Corresponding added. See :pep:`616` for a full description. (Contributed by Dennis Sweeney in :issue:`39939`.) -PEP 585: Builtin Generic Types ------------------------------- +Type Hinting Generics in Standard Collections +--------------------------------------------- In type annotations you can now use built-in collection types such as ``list`` and ``dict`` as generic types instead of importing the @@ -135,8 +191,8 @@ Example: See :pep:`585` for more details. (Contributed by Guido van Rossum, Ethan Smith, and Batuhan Taşkaya in :issue:`39481`.) -PEP 617: New Parser -------------------- +New Parser +---------- Python 3.9 uses a new parser, based on `PEG <https://en.wikipedia.org/wiki/Parsing_expression_grammar>`_ instead @@ -167,7 +223,6 @@ Other Language Changes its top-level package. (Contributed by Ngalim Siregar in :issue:`37444`.) - * Python now gets the absolute path of the script filename specified on the command line (ex: ``python3 script.py``): the ``__file__`` attribute of the :mod:`__main__` module became an absolute path, rather than a relative @@ -201,6 +256,17 @@ Other Language Changes for the correspondent concrete type (``list`` in this case). (Contributed by Serhiy Storchaka in :issue:`40257`.) +* Parallel running of :meth:`~agen.aclose` / :meth:`~agen.asend` / + :meth:`~agen.athrow` is now prohibited, and ``ag_running`` now reflects + the actual running status of the async generator. + (Contributed by Yury Selivanov in :issue:`30773`.) + +* Unexpected errors in calling the ``__iter__`` method are no longer masked by + ``TypeError`` in the :keyword:`in` operator and functions + :func:`~operator.contains`, :func:`~operator.indexOf` and + :func:`~operator.countOf` of the :mod:`operator` module. + (Contributed by Serhiy Storchaka in :issue:`40824`.) + New Modules =========== @@ -248,9 +314,10 @@ PyPI and maintained by the CPython core team. graphlib --------- -Add the :mod:`graphlib` that contains the :class:`graphlib.TopologicalSorter` class -to offer functionality to perform topological sorting of graphs. (Contributed by Pablo -Galindo, Tim Peters and Larry Hastings in :issue:`17005`.) +A new module, :mod:`graphlib`, was added that contains the +:class:`graphlib.TopologicalSorter` class to offer functionality to perform +topological sorting of graphs. (Contributed by Pablo Galindo, Tim Peters and +Larry Hastings in :issue:`17005`.) Improved Modules @@ -296,6 +363,15 @@ loop, and essentially works as a high-level version of :meth:`~asyncio.loop.run_in_executor` that can directly take keyword arguments. (Contributed by Kyle Stanley and Yury Selivanov in :issue:`32309`.) +When cancelling the task due to a timeout, :meth:`asyncio.wait_for` will now +wait until the cancellation is complete also in the case when *timeout* is +<= 0, like it does with positive timeouts. +(Contributed by Elvis Pranskevichus in :issue:`32751`.) + +:mod:`asyncio` now raises :exc:`TyperError` when calling incompatible +methods with an :class:`ssl.SSLSocket` socket. +(Contributed by Ido Michael in :issue:`37404`.) + compileall ---------- @@ -328,7 +404,7 @@ startup overhead and reduces the amount of lost CPU time to idle workers. curses ------ -Add :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, +Added :func:`curses.get_escdelay`, :func:`curses.set_escdelay`, :func:`curses.get_tabsize`, and :func:`curses.set_tabsize` functions. (Contributed by Anthony Sottile in :issue:`38312`.) @@ -375,12 +451,17 @@ finalized by the garbage collector. (Contributed by Pablo Galindo in hashlib ------- +The :mod:`hashlib` module can now use SHA3 hashes and SHAKE XOF from OpenSSL +when available. +(Contributed by Christian Heimes in :issue:`37630`.) + Builtin hash modules can now be disabled with ``./configure --without-builtin-hashlib-hashes`` or selectively enabled with e.g. ``./configure --with-builtin-hashlib-hashes=sha3,blake2`` to force use of OpenSSL based implementation. (Contributed by Christian Heimes in :issue:`40479`) + http ---- @@ -390,13 +471,13 @@ HTTP status codes ``103 EARLY_HINTS``, ``418 IM_A_TEAPOT`` and ``425 TOO_EARLY`` IDLE and idlelib ---------------- -Add option to toggle cursor blink off. (Contributed by Zackery Spytz +Added option to toggle cursor blink off. (Contributed by Zackery Spytz in :issue:`4603`.) Escape key now closes IDLE completion windows. (Contributed by Johnny Najera in :issue:`38944`.) -Add keywords to module name completion list. (Contributed by Terry J. +Added keywords to module name completion list. (Contributed by Terry J. Reedy in :issue:`37765`.) The changes above have been backported to 3.8 maintenance releases. @@ -426,6 +507,17 @@ now raises :exc:`ImportError` instead of :exc:`ValueError` for invalid relative import attempts. (Contributed by Ngalim Siregar in :issue:`37444`.) +Import loaders which publish immutable module objects can now publish +immutable packages in addition to individual modules. +(Contributed by Dino Viehland in :issue:`39336`.) + +Added :func:`importlib.resources.files` function with support for +subdirectories in package data, matching backport in ``importlib_resources`` +version 1.5. +(Contributed by Jason R. Coombs in :issue:`39791`.) + +Refreshed ``importlib.metadata`` from ``importlib_metadata`` version 1.6.1. + inspect ------- @@ -448,15 +540,15 @@ Expanded the :func:`math.gcd` function to handle multiple arguments. Formerly, it only supported two arguments. (Contributed by Serhiy Storchaka in :issue:`39648`.) -Add :func:`math.lcm`: return the least common multiple of specified arguments. +Added :func:`math.lcm`: return the least common multiple of specified arguments. (Contributed by Mark Dickinson, Ananthakrishnan and Serhiy Storchaka in :issue:`39479` and :issue:`39648`.) -Add :func:`math.nextafter`: return the next floating-point value after *x* +Added :func:`math.nextafter`: return the next floating-point value after *x* towards *y*. (Contributed by Victor Stinner in :issue:`39288`.) -Add :func:`math.ulp`: return the value of the least significant bit +Added :func:`math.ulp`: return the value of the least significant bit of a float. (Contributed by Victor Stinner in :issue:`39310`.) @@ -492,7 +584,7 @@ The :func:`os.putenv` and :func:`os.unsetenv` functions are now always available. (Contributed by Victor Stinner in :issue:`39395`.) -Add :func:`os.waitstatus_to_exitcode` function: +Added :func:`os.waitstatus_to_exitcode` function: convert a wait status to an exit code. (Contributed by Victor Stinner in :issue:`40094`.) @@ -503,6 +595,12 @@ Added :meth:`pathlib.Path.readlink()` which acts similarly to :func:`os.readlink`. (Contributed by Girts Folkmanis in :issue:`30618`) +pdb +--- + +On Windows now :class:`~pdb.Pdb` supports ``~/.pdbrc``. +(Contributed by Tim Hopper and Dan Lidral-Porter in :issue:`20523`.) + poplib ------ @@ -526,7 +624,7 @@ method etc, but for any object that has its own ``__doc__`` attribute. random ------ -Add a new :attr:`random.Random.randbytes` method: generate random bytes. +Added a new :attr:`random.Random.randbytes` method: generate random bytes. (Contributed by Victor Stinner in :issue:`40286`.) signal @@ -555,6 +653,11 @@ constant on Linux 4.1 and greater. The socket module now supports the :data:`~socket.CAN_J1939` protocol on platforms that support it. (Contributed by Karl Ding in :issue:`40291`.) +The socket module now has the :func:`socket.send_fds` and +:func:`socket.recv.fds` methods. (Contributed by Joannah Nanjekye, Shinya +Okano and Victor Stinner in :issue:`28724`.) + + time ---- @@ -566,7 +669,7 @@ which has nanosecond resolution, rather than sys --- -Add a new :attr:`sys.platlibdir` attribute: name of the platform-specific +Added a new :attr:`sys.platlibdir` attribute: name of the platform-specific library directory. It is used to build the path of standard library and the paths of installed extension modules. It is equal to ``"lib"`` on most platforms. On Fedora and SuSE, it is equal to ``"lib64"`` on 64-bit platforms. @@ -630,7 +733,7 @@ Optimizations (Contributed by Serhiy Storchaka in :issue:`32856`.) -* Optimize signal handling in multithreaded applications. If a thread different +* Optimized signal handling in multithreaded applications. If a thread different than the main thread gets a signal, the bytecode evaluation loop is no longer interrupted at each bytecode instruction to check for pending signals which cannot be handled. Only the main thread of the main interpreter can handle @@ -640,10 +743,36 @@ Optimizations until the main thread handles signals. (Contributed by Victor Stinner in :issue:`40010`.) -* Optimize the :mod:`subprocess` module on FreeBSD using ``closefrom()``. +* Optimized the :mod:`subprocess` module on FreeBSD using ``closefrom()``. (Contributed by Ed Maste, Conrad Meyer, Kyle Evans, Kubilay Kocak and Victor Stinner in :issue:`38061`.) +* :c:func:`PyLong_FromDouble` is now up to 1.87x faster for values that + fit into :c:type:`long`. + (Contributed by Sergey Fedoseev in :issue:`37986`.) + +* A number of Python builtins (:class:`range`, :class:`tuple`, :class:`set`, + :class:`frozenset`, :class:`list`, :class:`dict`) are now sped up by using + :pep:`590` vectorcall protocol. + (Contributed by Dong-hee Na, Mark Shannon, Jeroen Demeyer and Petr Viktorin in :issue:`37207`.) + +* Optimized :func:`~set.difference_update` for the case when the other set + is much larger than the base set. + (Suggested by Evgeny Kapun with code contributed by Michele Orrù in :issue:`8425`.) + +* Python's small object allocator (``obmalloc.c``) now allows (no more than) + one empty arena to remain available for immediate reuse, without returning + it to the OS. This prevents thrashing in simple loops where an arena could + be created and destroyed anew on each iteration. + (Contributed by Tim Peters in :issue:`37257`.) + +* :term:`floor division` of float operation now has a better performance. Also + the message of :exc:`ZeroDivisionError` for this operation is updated. + (Contributed by Dong-hee Na in :issue:`39434`.) + +* Decoding short ASCII strings with UTF-8 and ascii codecs is now about + 15% faster. (Contributed by Inada Naoki in :issue:`37348`.) + Here's a summary of performance improvements from Python 3.4 through Python 3.9: .. code-block:: none @@ -699,10 +828,6 @@ in nanoseconds. The benchmarks were measured on an running the macOS 64-bit builds found at `python.org <https://www.python.org/downloads/mac-osx/>`_. -* A number of Python builtins (:class:`range`, :class:`tuple`, :class:`set`, :class:`frozenset`, :class:`list`, :class:`dict`) - are now sped up by using :pep:`590` vectorcall protocol. - (Contributed by Dong-hee Na, Mark Shannon, Jeroen Demeyer and Petr Viktorin in :issue:`37207`.) - Deprecated ========== @@ -784,6 +909,9 @@ Deprecated * Passing ``None`` as the first argument to the :func:`shlex.split` function has been deprecated. (Contributed by Zackery Spytz in :issue:`33262`.) +* :func:`smtpd.MailmanProxy` is now deprecated as it is unusable without + an external module, ``mailman``. (Contributed by Samuel Colvin in :issue:`35800`.) + * The :mod:`lib2to3` module now emits a :exc:`PendingDeprecationWarning`. Python 3.9 switched to a PEG parser (see :pep:`617`), and Python 3.10 may include new language syntax that is not parsable by lib2to3's LL(1) parser. @@ -798,6 +926,8 @@ Deprecated .. _LibCST: https://libcst.readthedocs.io/ .. _parso: https://parso.readthedocs.io/ +.. _removed-in-python-39: + Removed ======= @@ -967,6 +1097,19 @@ Changes in the Python API of ``wchar_t`` since Python 3.3. (Contributed by Inada Naoki in :issue:`34538`.) +* The :func:`logging.getLogger` API now returns the root logger when passed + the name ``'root'``, whereas previously it returned a non-root logger named + ``'root'``. This could affect cases where user code explicitly wants a + non-root logger named ``'root'``, or instantiates a logger using + ``logging.getLogger(__name__)`` in some top-level module called ``'root.py'``. + (Contributed by Vinay Sajip in :issue:`37742`.) + +* Division handling of :class:`~pathlib.PurePath` now returns ``NotImplemented`` + instead of raising a :exc:`TypeError` when passed something other than an + instance of ``str`` or :class:`~pathlib.PurePath`. This allows creating + compatible classes that don't inherit from those mentioned types. + (Contributed by Roger Aiudi in :issue:`34775`). + Changes in the C API -------------------- @@ -1017,6 +1160,11 @@ Changes in the C API (See :issue:`35810` and :issue:`40217` for more information.) +* The functions ``PyEval_CallObject``, ``PyEval_CallFunction``, + ``PyEval_CallMethod`` and ``PyEval_CallObjectWithKeywords`` are deprecated. + Use :c:func:`PyObject_Call` and its variants instead. + (See more details in :issue:`29548`.) + CPython bytecode changes ------------------------ @@ -1025,11 +1173,21 @@ CPython bytecode changes correctly if the :exc:`AssertionError` exception was being shadowed. (Contributed by Zackery Spytz in :issue:`34880`.) +* The :opcode:`COMPARE_OP` opcode was split into four distinct instructions: + + * ``COMPARE_OP`` for rich comparisons + * ``IS_OP`` for 'is' and 'is not' tests + * ``CONTAINS_OP`` for 'in' and 'is not' tests + * ``JUMP_IF_NOT_EXC_MATCH`` for checking exceptions in 'try-except' + statements. + + (Contributed by Mark Shannon in :issue:`39156`.) + Build Changes ============= -* Add ``--with-platlibdir`` option to the ``configure`` script: name of the +* Added ``--with-platlibdir`` option to the ``configure`` script: name of the platform-specific library directory, stored in the new :attr:`sys.platlibdir` attribute. See :attr:`sys.platlibdir` attribute for more information. (Contributed by Jan Matějek, Matěj Cepl, Charalampos Stratakis @@ -1042,6 +1200,34 @@ Build Changes functions are now required to build Python. (Contributed by Victor Stinner in :issue:`39395`.) +* On non-Windows platforms, creating ``bdist_wininst`` installers is now + officially unsupported. (See :issue:`10945` for more details.) + +* When building Python on macOS from source, ``_tkinter`` now links with + non-system Tcl and Tk frameworks if they are installed in + ``/Library/Frameworks``, as had been the case on older releases + of macOS. If a macOS SDK is explicitly configured, by using + ``--enable-universalsdk=`` or ``-isysroot``, only the SDK itself is + searched. The default behavior can still be overridden with + ``--with-tcltk-includes`` and ``--with-tcltk-libs``. + (Contributed by Ned Deily in :issue:`34956`.) + +* Python can now be built for Windows 10 ARM64. + (Contributed by Steve Dower in :issue:`33125`.) + +* Some individual tests are now skipped when ``--pgo`` is used. The tests + in question increased the PGO task time significantly and likely + didn't help improve optimization of the final executable. This + speeds up the task by a factor of about 15x. Running the full unit test + suite is slow. This change may result in a slightly less optimized build + since not as many code branches will be executed. If you are willing to + wait for the much slower build, the old behavior can be restored using + ``./configure [..] PROFILE_TASK="-m test --pgo-extended"``. We make no + guarantees as to which PGO task set produces a faster build. Users who care + should run their own relevant benchmarks as results can depend on the + environment, workload, and compiler tool chain. + (See :issue:`36044` and :issue:`37707` for more details.) + C API Changes ============= @@ -1049,29 +1235,29 @@ C API Changes New Features ------------ -* :pep:`573`: Add :c:func:`PyType_FromModuleAndSpec` to associate +* :pep:`573`: Added :c:func:`PyType_FromModuleAndSpec` to associate a module with a class; :c:func:`PyType_GetModule` and :c:func:`PyType_GetModuleState` to retrieve the module and its state; and :c:data:`PyCMethod` and :c:data:`METH_METHOD` to allow a method to access the class it was defined in. (Contributed by Marcel Plch and Petr Viktorin in :issue:`38787`.) -* Add :c:func:`PyFrame_GetCode` function: get a frame code. - Add :c:func:`PyFrame_GetBack` function: get the frame next outer frame. +* Added :c:func:`PyFrame_GetCode` function: get a frame code. + Added :c:func:`PyFrame_GetBack` function: get the frame next outer frame. (Contributed by Victor Stinner in :issue:`40421`.) -* Add :c:func:`PyFrame_GetLineNumber` to the limited C API. +* Added :c:func:`PyFrame_GetLineNumber` to the limited C API. (Contributed by Victor Stinner in :issue:`40421`.) -* Add :c:func:`PyThreadState_GetInterpreter` and +* Added :c:func:`PyThreadState_GetInterpreter` and :c:func:`PyInterpreterState_Get` functions to get the interpreter. - Add :c:func:`PyThreadState_GetFrame` function to get the current frame of a + Added :c:func:`PyThreadState_GetFrame` function to get the current frame of a Python thread state. - Add :c:func:`PyThreadState_GetID` function: get the unique identifier of a + Added :c:func:`PyThreadState_GetID` function: get the unique identifier of a Python thread state. (Contributed by Victor Stinner in :issue:`39947`.) -* Add a new public :c:func:`PyObject_CallNoArgs` function to the C API, which +* Added a new public :c:func:`PyObject_CallNoArgs` function to the C API, which calls a callable Python object without any arguments. It is the most efficient way to call a callable Python object without any argument. (Contributed by Victor Stinner in :issue:`37194`.) @@ -1093,11 +1279,15 @@ New Features to a module. (Contributed by Dong-hee Na in :issue:`40024`.) -* Add the functions :c:func:`PyObject_GC_IsTracked` and +* Added the functions :c:func:`PyObject_GC_IsTracked` and :c:func:`PyObject_GC_IsFinalized` to the public API to allow to query if Python objects are being currently tracked or have been already finalized by - the garbage collector respectively. (Contributed by Pablo Galindo in - :issue:`40241`.) + the garbage collector respectively. + (Contributed by Pablo Galindo Salgado in :issue:`40241`.) + +* Added :c:func:`_PyObject_FunctionStr` to get a user-friendly string + representation of a function-like object. + (Patch by Jeroen Demeyer in :issue:`37645`.) Porting to Python 3.9 @@ -1144,10 +1334,44 @@ Porting to Python 3.9 Python 3.3. (Contributed by Inada Naoki in :issue:`36346`.) +* The :c:func:`Py_FatalError` function is replaced with a macro which logs + automatically the name of the current function, unless the + ``Py_LIMITED_API`` macro is defined. + (Contributed by Victor Stinner in :issue:`39882`.) + +* The vectorcall protocol now requires that the caller passes only strings as + keyword names. (See :issue:`37540` for more information.) + +* Implementation details of a number of macros and functions are now hidden: + + * :c:func:`PyObject_IS_GC` macro was converted to a function. + + * The :c:func:`PyObject_NEW` macro becomes an alias to the + :c:func:`PyObject_New` macro, and the :c:func:`PyObject_NEW_VAR` macro + becomes an alias to the :c:func:`PyObject_NewVar` macro. They no longer + access directly the :c:member:`PyTypeObject.tp_basicsize` member. + + * :c:func:`PyType_HasFeature` now always calls :c:func:`PyType_GetFlags`. + Previously, it accessed directly the :c:member:`PyTypeObject.tp_flags` + member when the limited C API was not used. + + * :c:func:`PyObject_GET_WEAKREFS_LISTPTR` macro was converted to a function: + the macro accessed directly the :c:member:`PyTypeObject.tp_weaklistoffset` + member. + + * :c:func:`PyObject_CheckBuffer` macro was converted to a function: the macro + accessed directly the :c:member:`PyTypeObject.tp_as_buffer` member. + + * :c:func:`PyIndex_Check` is now always declared as an opaque function to hide + implementation details: removed the ``PyIndex_Check()`` macro. The macro accessed + directly the :c:member:`PyTypeObject.tp_as_number` member. + + (See :issue:`40170` for more details.) + Removed ------- -* Exclude ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of +* Excluded ``PyFPE_START_PROTECT()`` and ``PyFPE_END_PROTECT()`` macros of ``pyfpe.h`` from the limited C API. (Contributed by Victor Stinner in :issue:`38835`.) @@ -1158,7 +1382,7 @@ Removed * Changes in the limited C API (if ``Py_LIMITED_API`` macro is defined): - * Exclude the following functions from the limited C API: + * Excluded the following functions from the limited C API: * ``PyThreadState_DeleteCurrent()`` (Contributed by Joannah Nanjekye in :issue:`37878`.) @@ -1175,7 +1399,7 @@ Removed * ``Py_TRASHCAN_SAFE_BEGIN`` * ``Py_TRASHCAN_SAFE_END`` - * Move following functions and definitions to the internal C API: + * Moved following functions and definitions to the internal C API: * ``_PyDebug_PrintTotalRefs()`` * ``_Py_PrintReferences()`` @@ -1185,12 +1409,12 @@ Removed (Contributed by Victor Stinner in :issue:`38644` and :issue:`39542`.) -* Remove ``_PyRuntime.getframe`` hook and remove ``_PyThreadState_GetFrame`` +* Removed ``_PyRuntime.getframe`` hook and removed ``_PyThreadState_GetFrame`` macro which was an alias to ``_PyRuntime.getframe``. They were only exposed - by the internal C API. Remove also ``PyThreadFrameGetter`` type. + by the internal C API. Removed also ``PyThreadFrameGetter`` type. (Contributed by Victor Stinner in :issue:`39946`.) -* Remove the following functions from the C API. Call :c:func:`PyGC_Collect` +* Removed the following functions from the C API. Call :c:func:`PyGC_Collect` explicitly to clear all free lists. (Contributed by Inada Naoki and Victor Stinner in :issue:`37340`, :issue:`38896` and :issue:`40428`.) @@ -1209,10 +1433,20 @@ Removed * ``PyUnicode_ClearFreeList()``: the Unicode free list has been removed in Python 3.3. -* Remove ``_PyUnicode_ClearStaticStrings()`` function. +* Removed ``_PyUnicode_ClearStaticStrings()`` function. (Contributed by Victor Stinner in :issue:`39465`.) -* Remove ``Py_UNICODE_MATCH``. It has been deprecated by :pep:`393`, and +* Removed ``Py_UNICODE_MATCH``. It has been deprecated by :pep:`393`, and broken since Python 3.3. The :c:func:`PyUnicode_Tailmatch` function can be used instead. (Contributed by Inada Naoki in :issue:`36346`.) + +* Cleaned header files of interfaces defined but with no implementation. + The public API symbols being removed are: + ``_PyBytes_InsertThousandsGroupingLocale``, + ``_PyBytes_InsertThousandsGrouping``, ``_Py_InitializeFromArgs``, + ``_Py_InitializeFromWideArgs``, ``_PyFloat_Repr``, ``_PyFloat_Digits``, + ``_PyFloat_DigitsInit``, ``PyFrame_ExtendStack``, ``_PyAIterWrapper_Type``, + ``PyNullImporter_Type``, ``PyCmpWrapper_Type``, ``PySortWrapper_Type``, + ``PyNoArgsFunction``. + (Contributed by Pablo Galindo Salgado in :issue:`39372`.) diff --git a/Include/patchlevel.h b/Include/patchlevel.h index a608ebf..a9e8ef1 100644 --- a/Include/patchlevel.h +++ b/Include/patchlevel.h @@ -19,11 +19,11 @@ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 9 #define PY_MICRO_VERSION 0 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 2 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.9.0rc2+" +#define PY_VERSION "3.9.0" /*--end constants--*/ /* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. diff --git a/Lib/pydoc_data/topics.py b/Lib/pydoc_data/topics.py index 288bdfa..40b4579 100644 --- a/Lib/pydoc_data/topics.py +++ b/Lib/pydoc_data/topics.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Wed Sep 16 23:08:58 2020 +# Autogenerated by Sphinx on Sun Oct 4 19:26:28 2020 topics = {'assert': 'The "assert" statement\n' '**********************\n' '\n' @@ -99,27 +99,26 @@ topics = {'assert': 'The "assert" statement\n' 'assigned,\n' ' from left to right, to the corresponding targets.\n' '\n' - ' * If the target list contains one target prefixed with an\n' - ' asterisk, called a “starred” target: The object must be ' - 'an\n' - ' iterable with at least as many items as there are targets ' - 'in the\n' - ' target list, minus one. The first items of the iterable ' - 'are\n' - ' assigned, from left to right, to the targets before the ' + ' * If the target list contains one target prefixed with an ' + 'asterisk,\n' + ' called a “starred” target: The object must be an iterable ' + 'with at\n' + ' least as many items as there are targets in the target ' + 'list, minus\n' + ' one. The first items of the iterable are assigned, from ' + 'left to\n' + ' right, to the targets before the starred target. The ' + 'final items\n' + ' of the iterable are assigned to the targets after the ' 'starred\n' - ' target. The final items of the iterable are assigned to ' - 'the\n' - ' targets after the starred target. A list of the remaining ' - 'items\n' - ' in the iterable is then assigned to the starred target ' - '(the list\n' - ' can be empty).\n' + ' target. A list of the remaining items in the iterable is ' + 'then\n' + ' assigned to the starred target (the list can be empty).\n' '\n' ' * Else: The object must be an iterable with the same number ' - 'of\n' - ' items as there are targets in the target list, and the ' - 'items are\n' + 'of items\n' + ' as there are targets in the target list, and the items ' + 'are\n' ' assigned, from left to right, to the corresponding ' 'targets.\n' '\n' @@ -135,10 +134,10 @@ topics = {'assert': 'The "assert" statement\n' 'in the\n' ' current local namespace.\n' '\n' - ' * Otherwise: the name is bound to the object in the global\n' - ' namespace or the outer namespace determined by ' - '"nonlocal",\n' - ' respectively.\n' + ' * Otherwise: the name is bound to the object in the global ' + 'namespace\n' + ' or the outer namespace determined by "nonlocal", ' + 'respectively.\n' '\n' ' The name is rebound if it was already bound. This may cause ' 'the\n' @@ -225,26 +224,27 @@ topics = {'assert': 'The "assert" statement\n' 'called with\n' ' appropriate arguments.\n' '\n' - '* If the target is a slicing: The primary expression in the\n' - ' reference is evaluated. It should yield a mutable sequence ' - 'object\n' - ' (such as a list). The assigned object should be a sequence ' - 'object\n' - ' of the same type. Next, the lower and upper bound ' - 'expressions are\n' - ' evaluated, insofar they are present; defaults are zero and ' - 'the\n' - ' sequence’s length. The bounds should evaluate to integers. ' - 'If\n' - ' either bound is negative, the sequence’s length is added to ' - 'it. The\n' - ' resulting bounds are clipped to lie between zero and the ' + '* If the target is a slicing: The primary expression in the ' + 'reference\n' + ' is evaluated. It should yield a mutable sequence object ' + '(such as a\n' + ' list). The assigned object should be a sequence object of ' + 'the same\n' + ' type. Next, the lower and upper bound expressions are ' + 'evaluated,\n' + ' insofar they are present; defaults are zero and the ' 'sequence’s\n' - ' length, inclusive. Finally, the sequence object is asked to ' - 'replace\n' - ' the slice with the items of the assigned sequence. The ' - 'length of\n' - ' the slice may be different from the length of the assigned ' + ' length. The bounds should evaluate to integers. If either ' + 'bound is\n' + ' negative, the sequence’s length is added to it. The ' + 'resulting\n' + ' bounds are clipped to lie between zero and the sequence’s ' + 'length,\n' + ' inclusive. Finally, the sequence object is asked to replace ' + 'the\n' + ' slice with the items of the assigned sequence. The length ' + 'of the\n' + ' slice may be different from the length of the assigned ' 'sequence,\n' ' thus changing the length of the target sequence, if the ' 'target\n' @@ -544,13 +544,17 @@ topics = {'assert': 'The "assert" statement\n' '\n' '-[ Footnotes ]-\n' '\n' - '[1] The exception is propagated to the invocation stack unless\n' - ' there is a "finally" clause which happens to raise another\n' - ' exception. That new exception causes the old one to be lost.\n' + '[1] The exception is propagated to the invocation stack unless ' + 'there\n' + ' is a "finally" clause which happens to raise another ' + 'exception.\n' + ' That new exception causes the old one to be lost.\n' '\n' - '[2] A string literal appearing as the first statement in the\n' - ' function body is transformed into the function’s "__doc__"\n' - ' attribute and therefore the function’s *docstring*.\n' + '[2] A string literal appearing as the first statement in the ' + 'function\n' + ' body is transformed into the function’s "__doc__" attribute ' + 'and\n' + ' therefore the function’s *docstring*.\n' '\n' '[3] A string literal appearing as the first statement in the class\n' ' body is transformed into the namespace’s "__doc__" item and\n' @@ -688,11 +692,13 @@ topics = {'assert': 'The "assert" statement\n' 'needs, for\n' ' example, "object.__getattribute__(self, name)".\n' '\n' - ' Note: This method may still be bypassed when looking ' - 'up special\n' - ' methods as the result of implicit invocation via ' - 'language syntax\n' - ' or built-in functions. See Special method lookup.\n' + ' Note:\n' + '\n' + ' This method may still be bypassed when looking up ' + 'special methods\n' + ' as the result of implicit invocation via language ' + 'syntax or\n' + ' built-in functions. See Special method lookup.\n' '\n' 'object.__setattr__(self, name, value)\n' '\n' @@ -776,15 +782,16 @@ topics = {'assert': 'The "assert" statement\n' '\n' ' sys.modules[__name__].__class__ = VerboseModule\n' '\n' - 'Note: Defining module "__getattr__" and setting module ' - '"__class__"\n' - ' only affect lookups made using the attribute access ' - 'syntax –\n' - ' directly accessing the module globals (whether by code ' - 'within the\n' - ' module, or via a reference to the module’s globals ' - 'dictionary) is\n' - ' unaffected.\n' + 'Note:\n' + '\n' + ' Defining module "__getattr__" and setting module ' + '"__class__" only\n' + ' affect lookups made using the attribute access syntax ' + '– directly\n' + ' accessing the module globals (whether by code within ' + 'the module, or\n' + ' via a reference to the module’s globals dictionary) is ' + 'unaffected.\n' '\n' 'Changed in version 3.5: "__class__" module attribute is ' 'now writable.\n' @@ -867,12 +874,14 @@ topics = {'assert': 'The "assert" statement\n' 'created. The\n' ' descriptor has been assigned to *name*.\n' '\n' - ' Note: "__set_name__()" is only called implicitly as ' - 'part of the\n' - ' "type" constructor, so it will need to be called ' - 'explicitly with\n' - ' the appropriate parameters when a descriptor is ' - 'added to a class\n' + ' Note:\n' + '\n' + ' "__set_name__()" is only called implicitly as part ' + 'of the "type"\n' + ' constructor, so it will need to be called ' + 'explicitly with the\n' + ' appropriate parameters when a descriptor is added ' + 'to a class\n' ' after initial creation:\n' '\n' ' class A:\n' @@ -1033,10 +1042,9 @@ topics = {'assert': 'The "assert" statement\n' '--------------------------\n' '\n' '* When inheriting from a class without *__slots__*, the ' - '*__dict__*\n' - ' and *__weakref__* attribute of the instances will ' - 'always be\n' - ' accessible.\n' + '*__dict__* and\n' + ' *__weakref__* attribute of the instances will always ' + 'be accessible.\n' '\n' '* Without a *__dict__* variable, instances cannot be ' 'assigned new\n' @@ -1051,14 +1059,12 @@ topics = {'assert': 'The "assert" statement\n' ' declaration.\n' '\n' '* Without a *__weakref__* variable for each instance, ' - 'classes\n' - ' defining *__slots__* do not support weak references to ' - 'its\n' - ' instances. If weak reference support is needed, then ' - 'add\n' - ' "\'__weakref__\'" to the sequence of strings in the ' - '*__slots__*\n' - ' declaration.\n' + 'classes defining\n' + ' *__slots__* do not support weak references to its ' + 'instances. If weak\n' + ' reference support is needed, then add ' + '"\'__weakref__\'" to the\n' + ' sequence of strings in the *__slots__* declaration.\n' '\n' '* *__slots__* are implemented at the class level by ' 'creating\n' @@ -1071,24 +1077,23 @@ topics = {'assert': 'The "assert" statement\n' ' attribute would overwrite the descriptor assignment.\n' '\n' '* The action of a *__slots__* declaration is not limited ' - 'to the\n' - ' class where it is defined. *__slots__* declared in ' - 'parents are\n' - ' available in child classes. However, child subclasses ' - 'will get a\n' - ' *__dict__* and *__weakref__* unless they also define ' - '*__slots__*\n' - ' (which should only contain names of any *additional* ' - 'slots).\n' + 'to the class\n' + ' where it is defined. *__slots__* declared in parents ' + 'are available\n' + ' in child classes. However, child subclasses will get a ' + '*__dict__*\n' + ' and *__weakref__* unless they also define *__slots__* ' + '(which should\n' + ' only contain names of any *additional* slots).\n' '\n' '* If a class defines a slot also defined in a base ' - 'class, the\n' - ' instance variable defined by the base class slot is ' - 'inaccessible\n' - ' (except by retrieving its descriptor directly from the ' - 'base class).\n' - ' This renders the meaning of the program undefined. In ' - 'the future, a\n' + 'class, the instance\n' + ' variable defined by the base class slot is ' + 'inaccessible (except by\n' + ' retrieving its descriptor directly from the base ' + 'class). This\n' + ' renders the meaning of the program undefined. In the ' + 'future, a\n' ' check may be added to prevent this.\n' '\n' '* Nonempty *__slots__* does not work for classes derived ' @@ -1097,9 +1102,9 @@ topics = {'assert': 'The "assert" statement\n' '"bytes" and "tuple".\n' '\n' '* Any non-string iterable may be assigned to ' - '*__slots__*. Mappings\n' - ' may also be used; however, in the future, special ' - 'meaning may be\n' + '*__slots__*. Mappings may\n' + ' also be used; however, in the future, special meaning ' + 'may be\n' ' assigned to the values corresponding to each key.\n' '\n' '* *__class__* assignment works only if both classes have ' @@ -1115,9 +1120,9 @@ topics = {'assert': 'The "assert" statement\n' ' raise "TypeError".\n' '\n' '* If an iterator is used for *__slots__* then a ' - 'descriptor is\n' - ' created for each of the iterator’s values. However, ' - 'the *__slots__*\n' + 'descriptor is created\n' + ' for each of the iterator’s values. However, the ' + '*__slots__*\n' ' attribute will be an empty iterator.\n', 'attribute-references': 'Attribute references\n' '********************\n' @@ -1882,10 +1887,10 @@ topics = {'assert': 'The "assert" statement\n' ' != x" is true. This behavior is compliant with IEEE 754.\n' '\n' '* "None" and "NotImplemented" are singletons. **PEP 8** ' - 'advises\n' - ' that comparisons for singletons should always be done with ' - '"is" or\n' - ' "is not", never the equality operators.\n' + 'advises that\n' + ' comparisons for singletons should always be done with "is" ' + 'or "is\n' + ' not", never the equality operators.\n' '\n' '* Binary sequences (instances of "bytes" or "bytearray") can ' 'be\n' @@ -1901,15 +1906,15 @@ topics = {'assert': 'The "assert" statement\n' '\n' ' Strings and binary sequences cannot be directly compared.\n' '\n' - '* Sequences (instances of "tuple", "list", or "range") can ' - 'be\n' - ' compared only within each of their types, with the ' - 'restriction that\n' - ' ranges do not support order comparison. Equality ' - 'comparison across\n' - ' these types results in inequality, and ordering comparison ' - 'across\n' - ' these types raises "TypeError".\n' + '* Sequences (instances of "tuple", "list", or "range") can be ' + 'compared\n' + ' only within each of their types, with the restriction that ' + 'ranges do\n' + ' not support order comparison. Equality comparison across ' + 'these\n' + ' types results in inequality, and ordering comparison across ' + 'these\n' + ' types raises "TypeError".\n' '\n' ' Sequences compare lexicographically using comparison of\n' ' corresponding elements. The built-in containers typically ' @@ -1933,8 +1938,8 @@ topics = {'assert': 'The "assert" statement\n' ' false because the type is not the same).\n' '\n' ' * Collections that support order comparison are ordered the ' - 'same\n' - ' as their first unequal elements (for example, "[1,2,x] <= ' + 'same as\n' + ' their first unequal elements (for example, "[1,2,x] <= ' '[1,2,y]"\n' ' has the same value as "x <= y"). If a corresponding ' 'element does\n' @@ -1952,8 +1957,8 @@ topics = {'assert': 'The "assert" statement\n' '"TypeError".\n' '\n' '* Sets (instances of "set" or "frozenset") can be compared ' - 'within\n' - ' and across their types.\n' + 'within and\n' + ' across their types.\n' '\n' ' They define order comparison operators to mean subset and ' 'superset\n' @@ -1972,8 +1977,8 @@ topics = {'assert': 'The "assert" statement\n' ' Comparison of sets enforces reflexivity of its elements.\n' '\n' '* Most other built-in types have no comparison methods ' - 'implemented,\n' - ' so they inherit the default comparison behavior.\n' + 'implemented, so\n' + ' they inherit the default comparison behavior.\n' '\n' 'User-defined classes that customize their comparison behavior ' 'should\n' @@ -2022,10 +2027,10 @@ topics = {'assert': 'The "assert" statement\n' ' "total_ordering()" decorator.\n' '\n' '* The "hash()" result should be consistent with equality. ' - 'Objects\n' - ' that are equal should either have the same hash value, or ' - 'be marked\n' - ' as unhashable.\n' + 'Objects that\n' + ' are equal should either have the same hash value, or be ' + 'marked as\n' + ' unhashable.\n' '\n' 'Python does not enforce these consistency rules. In fact, ' 'the\n' @@ -2299,10 +2304,11 @@ topics = {'assert': 'The "assert" statement\n' ':= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, ' '2]".\n' '\n' - 'Note: There is a subtlety when the sequence is being modified by ' - 'the\n' - ' loop (this can only occur for mutable sequences, e.g. lists). ' - 'An\n' + 'Note:\n' + '\n' + ' There is a subtlety when the sequence is being modified by the ' + 'loop\n' + ' (this can only occur for mutable sequences, e.g. lists). An\n' ' internal counter is used to keep track of which item is used ' 'next,\n' ' and this is incremented on each iteration. When this counter ' @@ -2525,8 +2531,8 @@ topics = {'assert': 'The "assert" statement\n' 'follows:\n' '\n' '1. The context expression (the expression given in the ' - '"with_item")\n' - ' is evaluated to obtain a context manager.\n' + '"with_item") is\n' + ' evaluated to obtain a context manager.\n' '\n' '2. The context manager’s "__enter__()" is loaded for later use.\n' '\n' @@ -2534,13 +2540,15 @@ topics = {'assert': 'The "assert" statement\n' '\n' '4. The context manager’s "__enter__()" method is invoked.\n' '\n' - '5. If a target was included in the "with" statement, the return\n' - ' value from "__enter__()" is assigned to it.\n' + '5. If a target was included in the "with" statement, the return ' + 'value\n' + ' from "__enter__()" is assigned to it.\n' + '\n' + ' Note:\n' '\n' - ' Note: The "with" statement guarantees that if the ' - '"__enter__()"\n' - ' method returns without an error, then "__exit__()" will ' - 'always be\n' + ' The "with" statement guarantees that if the "__enter__()" ' + 'method\n' + ' returns without an error, then "__exit__()" will always be\n' ' called. Thus, if an error occurs during the assignment to ' 'the\n' ' target list, it will be treated the same as an error ' @@ -3054,14 +3062,17 @@ topics = {'assert': 'The "assert" statement\n' '\n' '-[ Footnotes ]-\n' '\n' - '[1] The exception is propagated to the invocation stack unless\n' - ' there is a "finally" clause which happens to raise another\n' - ' exception. That new exception causes the old one to be ' - 'lost.\n' + '[1] The exception is propagated to the invocation stack unless ' + 'there\n' + ' is a "finally" clause which happens to raise another ' + 'exception.\n' + ' That new exception causes the old one to be lost.\n' '\n' - '[2] A string literal appearing as the first statement in the\n' - ' function body is transformed into the function’s "__doc__"\n' - ' attribute and therefore the function’s *docstring*.\n' + '[2] A string literal appearing as the first statement in the ' + 'function\n' + ' body is transformed into the function’s "__doc__" attribute ' + 'and\n' + ' therefore the function’s *docstring*.\n' '\n' '[3] A string literal appearing as the first statement in the ' 'class\n' @@ -3160,8 +3171,8 @@ topics = {'assert': 'The "assert" statement\n' ' complex;\n' '\n' '* otherwise, if either argument is a floating point number, ' - 'the\n' - ' other is converted to floating point;\n' + 'the other\n' + ' is converted to floating point;\n' '\n' '* otherwise, both must be integers and no conversion is ' 'necessary.\n' @@ -3271,7 +3282,9 @@ topics = {'assert': 'The "assert" statement\n' 'for\n' ' objects that still exist when the interpreter exits.\n' '\n' - ' Note: "del x" doesn’t directly call "x.__del__()" — the ' + ' Note:\n' + '\n' + ' "del x" doesn’t directly call "x.__del__()" — the ' 'former\n' ' decrements the reference count for "x" by one, and the ' 'latter is\n' @@ -3295,13 +3308,15 @@ topics = {'assert': 'The "assert" statement\n' '\n' ' See also: Documentation for the "gc" module.\n' '\n' - ' Warning: Due to the precarious circumstances under ' - 'which\n' - ' "__del__()" methods are invoked, exceptions that occur ' - 'during\n' - ' their execution are ignored, and a warning is printed ' - 'to\n' - ' "sys.stderr" instead. In particular:\n' + ' Warning:\n' + '\n' + ' Due to the precarious circumstances under which ' + '"__del__()"\n' + ' methods are invoked, exceptions that occur during ' + 'their execution\n' + ' are ignored, and a warning is printed to "sys.stderr" ' + 'instead.\n' + ' In particular:\n' '\n' ' * "__del__()" can be invoked when arbitrary code is ' 'being\n' @@ -3314,22 +3329,20 @@ topics = {'assert': 'The "assert" statement\n' ' that gets interrupted to execute "__del__()".\n' '\n' ' * "__del__()" can be executed during interpreter ' - 'shutdown. As\n' - ' a consequence, the global variables it needs to ' - 'access\n' - ' (including other modules) may already have been ' - 'deleted or set\n' - ' to "None". Python guarantees that globals whose name ' - 'begins\n' - ' with a single underscore are deleted from their ' - 'module before\n' - ' other globals are deleted; if no other references to ' - 'such\n' - ' globals exist, this may help in assuring that ' - 'imported modules\n' - ' are still available at the time when the "__del__()" ' - 'method is\n' - ' called.\n' + 'shutdown. As a\n' + ' consequence, the global variables it needs to access ' + '(including\n' + ' other modules) may already have been deleted or set ' + 'to "None".\n' + ' Python guarantees that globals whose name begins ' + 'with a single\n' + ' underscore are deleted from their module before ' + 'other globals\n' + ' are deleted; if no other references to such globals ' + 'exist, this\n' + ' may help in assuring that imported modules are still ' + 'available\n' + ' at the time when the "__del__()" method is called.\n' '\n' 'object.__repr__(self)\n' '\n' @@ -3505,19 +3518,21 @@ topics = {'assert': 'The "assert" statement\n' ' def __hash__(self):\n' ' return hash((self.name, self.nick, self.color))\n' '\n' - ' Note: "hash()" truncates the value returned from an ' - 'object’s\n' - ' custom "__hash__()" method to the size of a ' - '"Py_ssize_t". This\n' - ' is typically 8 bytes on 64-bit builds and 4 bytes on ' - '32-bit\n' - ' builds. If an object’s "__hash__()" must ' - 'interoperate on builds\n' - ' of different bit sizes, be sure to check the width on ' - 'all\n' - ' supported builds. An easy way to do this is with ' - '"python -c\n' - ' "import sys; print(sys.hash_info.width)"".\n' + ' Note:\n' + '\n' + ' "hash()" truncates the value returned from an object’s ' + 'custom\n' + ' "__hash__()" method to the size of a "Py_ssize_t". ' + 'This is\n' + ' typically 8 bytes on 64-bit builds and 4 bytes on ' + '32-bit builds.\n' + ' If an object’s "__hash__()" must interoperate on ' + 'builds of\n' + ' different bit sizes, be sure to check the width on all ' + 'supported\n' + ' builds. An easy way to do this is with "python -c ' + '"import sys;\n' + ' print(sys.hash_info.width)"".\n' '\n' ' If a class does not define an "__eq__()" method it ' 'should not\n' @@ -3575,22 +3590,24 @@ topics = {'assert': 'The "assert" statement\n' ' hashable by an "isinstance(obj, ' 'collections.abc.Hashable)" call.\n' '\n' - ' Note: By default, the "__hash__()" values of str and ' - 'bytes\n' - ' objects are “salted” with an unpredictable random ' - 'value.\n' - ' Although they remain constant within an individual ' - 'Python\n' - ' process, they are not predictable between repeated ' - 'invocations of\n' - ' Python.This is intended to provide protection against ' - 'a denial-\n' - ' of-service caused by carefully-chosen inputs that ' - 'exploit the\n' - ' worst case performance of a dict insertion, O(n^2) ' - 'complexity.\n' - ' See ' - 'http://www.ocert.org/advisories/ocert-2011-003.html for\n' + ' Note:\n' + '\n' + ' By default, the "__hash__()" values of str and bytes ' + 'objects are\n' + ' “salted” with an unpredictable random value. Although ' + 'they\n' + ' remain constant within an individual Python process, ' + 'they are not\n' + ' predictable between repeated invocations of ' + 'Python.This is\n' + ' intended to provide protection against a ' + 'denial-of-service caused\n' + ' by carefully-chosen inputs that exploit the worst ' + 'case\n' + ' performance of a dict insertion, O(n^2) complexity. ' + 'See\n' + ' http://www.ocert.org/advisories/ocert-2011-003.html ' + 'for\n' ' details.Changing hash values affects the iteration ' 'order of sets.\n' ' Python has never made guarantees about this ordering ' @@ -4170,9 +4187,11 @@ topics = {'assert': 'The "assert" statement\n' 'its\n' ' value.\n' '\n' - ' Note: "print()" can also be used, but is not a debugger ' - 'command —\n' - ' this executes the Python "print()" function.\n' + ' Note:\n' + '\n' + ' "print()" can also be used, but is not a debugger command — ' + 'this\n' + ' executes the Python "print()" function.\n' '\n' 'pp expression\n' '\n' @@ -4304,8 +4323,8 @@ topics = {'assert': 'The "assert" statement\n' '-[ Footnotes ]-\n' '\n' '[1] Whether a frame is considered to originate in a certain ' - 'module\n' - ' is determined by the "__name__" in the frame globals.\n', + 'module is\n' + ' determined by the "__name__" in the frame globals.\n', 'del': 'The "del" statement\n' '*******************\n' '\n' @@ -4485,13 +4504,15 @@ topics = {'assert': 'The "assert" statement\n' 'about the\n' 'exceptional condition.\n' '\n' - 'Note: Exception messages are not part of the Python API. ' - 'Their\n' - ' contents may change from one version of Python to the next ' - 'without\n' - ' warning and should not be relied on by code which will run ' - 'under\n' - ' multiple versions of the interpreter.\n' + 'Note:\n' + '\n' + ' Exception messages are not part of the Python API. Their ' + 'contents\n' + ' may change from one version of Python to the next without ' + 'warning\n' + ' and should not be relied on by code which will run under ' + 'multiple\n' + ' versions of the interpreter.\n' '\n' 'See also the description of the "try" statement in section The ' 'try\n' @@ -4501,10 +4522,9 @@ topics = {'assert': 'The "assert" statement\n' '-[ Footnotes ]-\n' '\n' '[1] This limitation occurs because the code that is executed ' - 'by\n' - ' these operations is not available at the time the module ' - 'is\n' - ' compiled.\n', + 'by these\n' + ' operations is not available at the time the module is ' + 'compiled.\n', 'execmodel': 'Execution model\n' '***************\n' '\n' @@ -4810,13 +4830,15 @@ topics = {'assert': 'The "assert" statement\n' 'about the\n' 'exceptional condition.\n' '\n' - 'Note: Exception messages are not part of the Python API. ' - 'Their\n' - ' contents may change from one version of Python to the next ' - 'without\n' - ' warning and should not be relied on by code which will run ' - 'under\n' - ' multiple versions of the interpreter.\n' + 'Note:\n' + '\n' + ' Exception messages are not part of the Python API. Their ' + 'contents\n' + ' may change from one version of Python to the next without ' + 'warning\n' + ' and should not be relied on by code which will run under ' + 'multiple\n' + ' versions of the interpreter.\n' '\n' 'See also the description of the "try" statement in section The ' 'try\n' @@ -4825,11 +4847,10 @@ topics = {'assert': 'The "assert" statement\n' '\n' '-[ Footnotes ]-\n' '\n' - '[1] This limitation occurs because the code that is executed ' - 'by\n' - ' these operations is not available at the time the module ' - 'is\n' - ' compiled.\n', + '[1] This limitation occurs because the code that is executed by ' + 'these\n' + ' operations is not available at the time the module is ' + 'compiled.\n', 'exprlists': 'Expression lists\n' '****************\n' '\n' @@ -4948,8 +4969,11 @@ topics = {'assert': 'The "assert" statement\n' 'i\n' ':= a to b do"; e.g., "list(range(3))" returns the list "[0, 1, 2]".\n' '\n' - 'Note: There is a subtlety when the sequence is being modified by the\n' - ' loop (this can only occur for mutable sequences, e.g. lists). An\n' + 'Note:\n' + '\n' + ' There is a subtlety when the sequence is being modified by the ' + 'loop\n' + ' (this can only occur for mutable sequences, e.g. lists). An\n' ' internal counter is used to keep track of which item is used next,\n' ' and this is incremented on each iteration. When this counter has\n' ' reached the length of the sequence the loop terminates. This ' @@ -5957,7 +5981,9 @@ topics = {'assert': 'The "assert" statement\n' 'defined.\n' ' See section The import statement.\n' '\n' - ' Note: The name "_" is often used in conjunction with\n' + ' Note:\n' + '\n' + ' The name "_" is often used in conjunction with\n' ' internationalization; refer to the documentation for the\n' ' "gettext" module for more information on this ' 'convention.\n' @@ -6103,7 +6129,9 @@ topics = {'assert': 'The "assert" statement\n' 'defined.\n' ' See section The import statement.\n' '\n' - ' Note: The name "_" is often used in conjunction with\n' + ' Note:\n' + '\n' + ' The name "_" is often used in conjunction with\n' ' internationalization; refer to the documentation for ' 'the\n' ' "gettext" module for more information on this ' @@ -6188,8 +6216,9 @@ topics = {'assert': 'The "assert" statement\n' '\n' '1. find a module, loading and initializing it if necessary\n' '\n' - '2. define a name or names in the local namespace for the scope\n' - ' where the "import" statement occurs.\n' + '2. define a name or names in the local namespace for the scope ' + 'where\n' + ' the "import" statement occurs.\n' '\n' 'When the statement contains multiple clauses (separated by commas) ' 'the\n' @@ -6215,8 +6244,9 @@ topics = {'assert': 'The "assert" statement\n' 'made\n' 'available in the local namespace in one of three ways:\n' '\n' - '* If the module name is followed by "as", then the name following\n' - ' "as" is bound directly to the imported module.\n' + '* If the module name is followed by "as", then the name following ' + '"as"\n' + ' is bound directly to the imported module.\n' '\n' '* If no other name is specified, and the module being imported is ' 'a\n' @@ -6894,15 +6924,17 @@ topics = {'assert': 'The "assert" statement\n' '"__rpow__()" (the\n' ' coercion rules would become too complicated).\n' '\n' - ' Note: If the right operand’s type is a subclass of the ' - 'left\n' - ' operand’s type and that subclass provides the ' - 'reflected method\n' - ' for the operation, this method will be called before ' - 'the left\n' - ' operand’s non-reflected method. This behavior allows ' - 'subclasses\n' - ' to override their ancestors’ operations.\n' + ' Note:\n' + '\n' + ' If the right operand’s type is a subclass of the left ' + 'operand’s\n' + ' type and that subclass provides the reflected method ' + 'for the\n' + ' operation, this method will be called before the left ' + 'operand’s\n' + ' non-reflected method. This behavior allows subclasses ' + 'to\n' + ' override their ancestors’ operations.\n' '\n' 'object.__iadd__(self, other)\n' 'object.__isub__(self, other)\n' @@ -6946,13 +6978,15 @@ topics = {'assert': 'The "assert" statement\n' 'the data\n' ' model.\n' '\n' - ' Note: Due to a bug in the dispatching mechanism for ' - '"**=", a\n' - ' class that defines "__ipow__()" but returns ' - '"NotImplemented"\n' - ' would fail to fall back to "x.__pow__(y)" and ' - '"y.__rpow__(x)".\n' - ' This bug is fixed in Python 3.10.\n' + ' Note:\n' + '\n' + ' Due to a bug in the dispatching mechanism for "**=", a ' + 'class that\n' + ' defines "__ipow__()" but returns "NotImplemented" ' + 'would fail to\n' + ' fall back to "x.__pow__(y)" and "y.__rpow__(x)". This ' + 'bug is\n' + ' fixed in Python 3.10.\n' '\n' 'object.__neg__(self)\n' 'object.__pos__(self)\n' @@ -7230,8 +7264,8 @@ topics = {'assert': 'The "assert" statement\n' '-[ Footnotes ]-\n' '\n' '[1] While "abs(x%y) < abs(y)" is true mathematically, ' - 'for floats\n' - ' it may not be true numerically due to roundoff. For ' + 'for floats it\n' + ' may not be true numerically due to roundoff. For ' 'example, and\n' ' assuming a platform on which a Python float is an ' 'IEEE 754 double-\n' @@ -7296,22 +7330,22 @@ topics = {'assert': 'The "assert" statement\n' '"unicodedata.normalize()".\n' '\n' '[4] Due to automatic garbage-collection, free lists, and ' - 'the\n' - ' dynamic nature of descriptors, you may notice ' - 'seemingly unusual\n' - ' behaviour in certain uses of the "is" operator, like ' - 'those\n' - ' involving comparisons between instance methods, or ' - 'constants.\n' - ' Check their documentation for more info.\n' + 'the dynamic\n' + ' nature of descriptors, you may notice seemingly ' + 'unusual behaviour\n' + ' in certain uses of the "is" operator, like those ' + 'involving\n' + ' comparisons between instance methods, or constants. ' + 'Check their\n' + ' documentation for more info.\n' '\n' '[5] The "%" operator is also used for string formatting; ' 'the same\n' ' precedence applies.\n' '\n' '[6] The power operator "**" binds less tightly than an ' - 'arithmetic\n' - ' or bitwise unary operator on its right, that is, ' + 'arithmetic or\n' + ' bitwise unary operator on its right, that is, ' '"2**-1" is "0.5".\n', 'pass': 'The "pass" statement\n' '********************\n' @@ -7601,9 +7635,11 @@ topics = {'assert': 'The "assert" statement\n' '\n' ' New in version 3.4.\n' '\n' - 'Note: Slicing is done exclusively with the following three ' - 'methods.\n' - ' A call like\n' + 'Note:\n' + '\n' + ' Slicing is done exclusively with the following three ' + 'methods. A\n' + ' call like\n' '\n' ' a[1:2] = b\n' '\n' @@ -7634,7 +7670,9 @@ topics = {'assert': 'The "assert" statement\n' 'the\n' ' container), "KeyError" should be raised.\n' '\n' - ' Note: "for" loops expect that an "IndexError" will be ' + ' Note:\n' + '\n' + ' "for" loops expect that an "IndexError" will be ' 'raised for\n' ' illegal indexes to allow proper detection of the end ' 'of the\n' @@ -7870,26 +7908,26 @@ topics = {'assert': 'The "assert" statement\n' '-[ Footnotes ]-\n' '\n' '[1] Additional information on these special methods may be ' - 'found\n' - ' in the Python Reference Manual (Basic customization).\n' + 'found in\n' + ' the Python Reference Manual (Basic customization).\n' '\n' '[2] As a consequence, the list "[1, 2]" is considered equal ' - 'to\n' - ' "[1.0, 2.0]", and similarly for tuples.\n' + 'to "[1.0,\n' + ' 2.0]", and similarly for tuples.\n' '\n' '[3] They must have since the parser can’t tell the type of ' 'the\n' ' operands.\n' '\n' '[4] Cased characters are those with general category ' - 'property\n' - ' being one of “Lu” (Letter, uppercase), “Ll” (Letter, ' - 'lowercase),\n' - ' or “Lt” (Letter, titlecase).\n' - '\n' - '[5] To format only a tuple you should therefore provide a\n' - ' singleton tuple whose only element is the tuple to be ' - 'formatted.\n', + 'property being\n' + ' one of “Lu” (Letter, uppercase), “Ll” (Letter, ' + 'lowercase), or “Lt”\n' + ' (Letter, titlecase).\n' + '\n' + '[5] To format only a tuple you should therefore provide a ' + 'singleton\n' + ' tuple whose only element is the tuple to be formatted.\n', 'specialnames': 'Special method names\n' '********************\n' '\n' @@ -8034,7 +8072,9 @@ topics = {'assert': 'The "assert" statement\n' 'for\n' ' objects that still exist when the interpreter exits.\n' '\n' - ' Note: "del x" doesn’t directly call "x.__del__()" — the ' + ' Note:\n' + '\n' + ' "del x" doesn’t directly call "x.__del__()" — the ' 'former\n' ' decrements the reference count for "x" by one, and the ' 'latter is\n' @@ -8058,12 +8098,15 @@ topics = {'assert': 'The "assert" statement\n' '\n' ' See also: Documentation for the "gc" module.\n' '\n' - ' Warning: Due to the precarious circumstances under which\n' - ' "__del__()" methods are invoked, exceptions that occur ' - 'during\n' - ' their execution are ignored, and a warning is printed ' - 'to\n' - ' "sys.stderr" instead. In particular:\n' + ' Warning:\n' + '\n' + ' Due to the precarious circumstances under which ' + '"__del__()"\n' + ' methods are invoked, exceptions that occur during their ' + 'execution\n' + ' are ignored, and a warning is printed to "sys.stderr" ' + 'instead.\n' + ' In particular:\n' '\n' ' * "__del__()" can be invoked when arbitrary code is ' 'being\n' @@ -8076,22 +8119,20 @@ topics = {'assert': 'The "assert" statement\n' ' that gets interrupted to execute "__del__()".\n' '\n' ' * "__del__()" can be executed during interpreter ' - 'shutdown. As\n' - ' a consequence, the global variables it needs to ' - 'access\n' - ' (including other modules) may already have been ' - 'deleted or set\n' - ' to "None". Python guarantees that globals whose name ' - 'begins\n' - ' with a single underscore are deleted from their ' - 'module before\n' - ' other globals are deleted; if no other references to ' - 'such\n' - ' globals exist, this may help in assuring that ' - 'imported modules\n' - ' are still available at the time when the "__del__()" ' - 'method is\n' - ' called.\n' + 'shutdown. As a\n' + ' consequence, the global variables it needs to access ' + '(including\n' + ' other modules) may already have been deleted or set ' + 'to "None".\n' + ' Python guarantees that globals whose name begins with ' + 'a single\n' + ' underscore are deleted from their module before other ' + 'globals\n' + ' are deleted; if no other references to such globals ' + 'exist, this\n' + ' may help in assuring that imported modules are still ' + 'available\n' + ' at the time when the "__del__()" method is called.\n' '\n' 'object.__repr__(self)\n' '\n' @@ -8267,19 +8308,21 @@ topics = {'assert': 'The "assert" statement\n' ' def __hash__(self):\n' ' return hash((self.name, self.nick, self.color))\n' '\n' - ' Note: "hash()" truncates the value returned from an ' - 'object’s\n' - ' custom "__hash__()" method to the size of a ' - '"Py_ssize_t". This\n' - ' is typically 8 bytes on 64-bit builds and 4 bytes on ' - '32-bit\n' - ' builds. If an object’s "__hash__()" must interoperate ' - 'on builds\n' - ' of different bit sizes, be sure to check the width on ' - 'all\n' - ' supported builds. An easy way to do this is with ' - '"python -c\n' - ' "import sys; print(sys.hash_info.width)"".\n' + ' Note:\n' + '\n' + ' "hash()" truncates the value returned from an object’s ' + 'custom\n' + ' "__hash__()" method to the size of a "Py_ssize_t". ' + 'This is\n' + ' typically 8 bytes on 64-bit builds and 4 bytes on ' + '32-bit builds.\n' + ' If an object’s "__hash__()" must interoperate on ' + 'builds of\n' + ' different bit sizes, be sure to check the width on all ' + 'supported\n' + ' builds. An easy way to do this is with "python -c ' + '"import sys;\n' + ' print(sys.hash_info.width)"".\n' '\n' ' If a class does not define an "__eq__()" method it should ' 'not\n' @@ -8335,21 +8378,22 @@ topics = {'assert': 'The "assert" statement\n' ' hashable by an "isinstance(obj, ' 'collections.abc.Hashable)" call.\n' '\n' - ' Note: By default, the "__hash__()" values of str and ' - 'bytes\n' - ' objects are “salted” with an unpredictable random ' - 'value.\n' - ' Although they remain constant within an individual ' - 'Python\n' - ' process, they are not predictable between repeated ' - 'invocations of\n' - ' Python.This is intended to provide protection against a ' - 'denial-\n' - ' of-service caused by carefully-chosen inputs that ' - 'exploit the\n' - ' worst case performance of a dict insertion, O(n^2) ' - 'complexity.\n' - ' See http://www.ocert.org/advisories/ocert-2011-003.html ' + ' Note:\n' + '\n' + ' By default, the "__hash__()" values of str and bytes ' + 'objects are\n' + ' “salted” with an unpredictable random value. Although ' + 'they\n' + ' remain constant within an individual Python process, ' + 'they are not\n' + ' predictable between repeated invocations of Python.This ' + 'is\n' + ' intended to provide protection against a ' + 'denial-of-service caused\n' + ' by carefully-chosen inputs that exploit the worst case\n' + ' performance of a dict insertion, O(n^2) complexity. ' + 'See\n' + ' http://www.ocert.org/advisories/ocert-2011-003.html ' 'for\n' ' details.Changing hash values affects the iteration ' 'order of sets.\n' @@ -8438,11 +8482,13 @@ topics = {'assert': 'The "assert" statement\n' 'needs, for\n' ' example, "object.__getattribute__(self, name)".\n' '\n' - ' Note: This method may still be bypassed when looking up ' - 'special\n' - ' methods as the result of implicit invocation via ' - 'language syntax\n' - ' or built-in functions. See Special method lookup.\n' + ' Note:\n' + '\n' + ' This method may still be bypassed when looking up ' + 'special methods\n' + ' as the result of implicit invocation via language ' + 'syntax or\n' + ' built-in functions. See Special method lookup.\n' '\n' 'object.__setattr__(self, name, value)\n' '\n' @@ -8526,15 +8572,16 @@ topics = {'assert': 'The "assert" statement\n' '\n' ' sys.modules[__name__].__class__ = VerboseModule\n' '\n' - 'Note: Defining module "__getattr__" and setting module ' - '"__class__"\n' - ' only affect lookups made using the attribute access syntax ' - '–\n' - ' directly accessing the module globals (whether by code ' - 'within the\n' - ' module, or via a reference to the module’s globals ' - 'dictionary) is\n' - ' unaffected.\n' + 'Note:\n' + '\n' + ' Defining module "__getattr__" and setting module ' + '"__class__" only\n' + ' affect lookups made using the attribute access syntax – ' + 'directly\n' + ' accessing the module globals (whether by code within the ' + 'module, or\n' + ' via a reference to the module’s globals dictionary) is ' + 'unaffected.\n' '\n' 'Changed in version 3.5: "__class__" module attribute is now ' 'writable.\n' @@ -8617,12 +8664,14 @@ topics = {'assert': 'The "assert" statement\n' 'The\n' ' descriptor has been assigned to *name*.\n' '\n' - ' Note: "__set_name__()" is only called implicitly as part ' - 'of the\n' - ' "type" constructor, so it will need to be called ' - 'explicitly with\n' - ' the appropriate parameters when a descriptor is added ' - 'to a class\n' + ' Note:\n' + '\n' + ' "__set_name__()" is only called implicitly as part of ' + 'the "type"\n' + ' constructor, so it will need to be called explicitly ' + 'with the\n' + ' appropriate parameters when a descriptor is added to a ' + 'class\n' ' after initial creation:\n' '\n' ' class A:\n' @@ -8781,10 +8830,9 @@ topics = {'assert': 'The "assert" statement\n' '~~~~~~~~~~~~~~~~~~~~~~~~~~\n' '\n' '* When inheriting from a class without *__slots__*, the ' - '*__dict__*\n' - ' and *__weakref__* attribute of the instances will always ' - 'be\n' - ' accessible.\n' + '*__dict__* and\n' + ' *__weakref__* attribute of the instances will always be ' + 'accessible.\n' '\n' '* Without a *__dict__* variable, instances cannot be ' 'assigned new\n' @@ -8798,13 +8846,12 @@ topics = {'assert': 'The "assert" statement\n' ' declaration.\n' '\n' '* Without a *__weakref__* variable for each instance, ' - 'classes\n' - ' defining *__slots__* do not support weak references to ' - 'its\n' - ' instances. If weak reference support is needed, then add\n' - ' "\'__weakref__\'" to the sequence of strings in the ' - '*__slots__*\n' - ' declaration.\n' + 'classes defining\n' + ' *__slots__* do not support weak references to its ' + 'instances. If weak\n' + ' reference support is needed, then add "\'__weakref__\'" to ' + 'the\n' + ' sequence of strings in the *__slots__* declaration.\n' '\n' '* *__slots__* are implemented at the class level by ' 'creating\n' @@ -8817,23 +8864,22 @@ topics = {'assert': 'The "assert" statement\n' ' attribute would overwrite the descriptor assignment.\n' '\n' '* The action of a *__slots__* declaration is not limited to ' - 'the\n' - ' class where it is defined. *__slots__* declared in ' - 'parents are\n' - ' available in child classes. However, child subclasses will ' - 'get a\n' - ' *__dict__* and *__weakref__* unless they also define ' - '*__slots__*\n' - ' (which should only contain names of any *additional* ' - 'slots).\n' + 'the class\n' + ' where it is defined. *__slots__* declared in parents are ' + 'available\n' + ' in child classes. However, child subclasses will get a ' + '*__dict__*\n' + ' and *__weakref__* unless they also define *__slots__* ' + '(which should\n' + ' only contain names of any *additional* slots).\n' '\n' '* If a class defines a slot also defined in a base class, ' - 'the\n' - ' instance variable defined by the base class slot is ' - 'inaccessible\n' - ' (except by retrieving its descriptor directly from the ' - 'base class).\n' - ' This renders the meaning of the program undefined. In the ' + 'the instance\n' + ' variable defined by the base class slot is inaccessible ' + '(except by\n' + ' retrieving its descriptor directly from the base class). ' + 'This\n' + ' renders the meaning of the program undefined. In the ' 'future, a\n' ' check may be added to prevent this.\n' '\n' @@ -8843,9 +8889,9 @@ topics = {'assert': 'The "assert" statement\n' 'and "tuple".\n' '\n' '* Any non-string iterable may be assigned to *__slots__*. ' - 'Mappings\n' - ' may also be used; however, in the future, special meaning ' - 'may be\n' + 'Mappings may\n' + ' also be used; however, in the future, special meaning may ' + 'be\n' ' assigned to the values corresponding to each key.\n' '\n' '* *__class__* assignment works only if both classes have the ' @@ -8861,8 +8907,8 @@ topics = {'assert': 'The "assert" statement\n' ' raise "TypeError".\n' '\n' '* If an iterator is used for *__slots__* then a descriptor ' - 'is\n' - ' created for each of the iterator’s values. However, the ' + 'is created\n' + ' for each of the iterator’s values. However, the ' '*__slots__*\n' ' attribute will be an empty iterator.\n' '\n' @@ -8915,9 +8961,11 @@ topics = {'assert': 'The "assert" statement\n' 'does nothing,\n' ' but raises an error if it is called with any arguments.\n' '\n' - ' Note: The metaclass hint "metaclass" is consumed by the ' - 'rest of\n' - ' the type machinery, and is never passed to ' + ' Note:\n' + '\n' + ' The metaclass hint "metaclass" is consumed by the rest ' + 'of the\n' + ' type machinery, and is never passed to ' '"__init_subclass__"\n' ' implementations. The actual metaclass (rather than the ' 'explicit\n' @@ -8985,9 +9033,10 @@ topics = {'assert': 'The "assert" statement\n' 'tuple may\n' 'be empty, in such case the original base is ignored.\n' '\n' - 'See also: **PEP 560** - Core support for typing module and ' - 'generic\n' - ' types\n' + 'See also:\n' + '\n' + ' **PEP 560** - Core support for typing module and generic ' + 'types\n' '\n' '\n' 'Determining the appropriate metaclass\n' @@ -9245,9 +9294,10 @@ topics = {'assert': 'The "assert" statement\n' 'type hints,\n' 'other usage is discouraged.\n' '\n' - 'See also: **PEP 560** - Core support for typing module and ' - 'generic\n' - ' types\n' + 'See also:\n' + '\n' + ' **PEP 560** - Core support for typing module and generic ' + 'types\n' '\n' '\n' 'Emulating callable objects\n' @@ -9359,9 +9409,11 @@ topics = {'assert': 'The "assert" statement\n' '\n' ' New in version 3.4.\n' '\n' - 'Note: Slicing is done exclusively with the following three ' - 'methods.\n' - ' A call like\n' + 'Note:\n' + '\n' + ' Slicing is done exclusively with the following three ' + 'methods. A\n' + ' call like\n' '\n' ' a[1:2] = b\n' '\n' @@ -9392,8 +9444,10 @@ topics = {'assert': 'The "assert" statement\n' 'the\n' ' container), "KeyError" should be raised.\n' '\n' - ' Note: "for" loops expect that an "IndexError" will be ' - 'raised for\n' + ' Note:\n' + '\n' + ' "for" loops expect that an "IndexError" will be raised ' + 'for\n' ' illegal indexes to allow proper detection of the end of ' 'the\n' ' sequence.\n' @@ -9583,15 +9637,17 @@ topics = {'assert': 'The "assert" statement\n' '"__rpow__()" (the\n' ' coercion rules would become too complicated).\n' '\n' - ' Note: If the right operand’s type is a subclass of the ' - 'left\n' - ' operand’s type and that subclass provides the reflected ' - 'method\n' - ' for the operation, this method will be called before ' - 'the left\n' - ' operand’s non-reflected method. This behavior allows ' - 'subclasses\n' - ' to override their ancestors’ operations.\n' + ' Note:\n' + '\n' + ' If the right operand’s type is a subclass of the left ' + 'operand’s\n' + ' type and that subclass provides the reflected method ' + 'for the\n' + ' operation, this method will be called before the left ' + 'operand’s\n' + ' non-reflected method. This behavior allows subclasses ' + 'to\n' + ' override their ancestors’ operations.\n' '\n' 'object.__iadd__(self, other)\n' 'object.__isub__(self, other)\n' @@ -9635,13 +9691,15 @@ topics = {'assert': 'The "assert" statement\n' 'the data\n' ' model.\n' '\n' - ' Note: Due to a bug in the dispatching mechanism for ' - '"**=", a\n' - ' class that defines "__ipow__()" but returns ' - '"NotImplemented"\n' - ' would fail to fall back to "x.__pow__(y)" and ' - '"y.__rpow__(x)".\n' - ' This bug is fixed in Python 3.10.\n' + ' Note:\n' + '\n' + ' Due to a bug in the dispatching mechanism for "**=", a ' + 'class that\n' + ' defines "__ipow__()" but returns "NotImplemented" would ' + 'fail to\n' + ' fall back to "x.__pow__(y)" and "y.__rpow__(x)". This ' + 'bug is\n' + ' fixed in Python 3.10.\n' '\n' 'object.__neg__(self)\n' 'object.__pos__(self)\n' @@ -10017,11 +10075,13 @@ topics = {'assert': 'The "assert" statement\n' '"-1" if\n' ' *sub* is not found.\n' '\n' - ' Note: The "find()" method should be used only if you ' - 'need to know\n' - ' the position of *sub*. To check if *sub* is a ' - 'substring or not,\n' - ' use the "in" operator:\n' + ' Note:\n' + '\n' + ' The "find()" method should be used only if you need ' + 'to know the\n' + ' position of *sub*. To check if *sub* is a substring ' + 'or not, use\n' + ' the "in" operator:\n' '\n' " >>> 'Py' in 'Python'\n" ' True\n' @@ -10050,8 +10110,9 @@ topics = {'assert': 'The "assert" statement\n' ' formatting options that can be specified in format ' 'strings.\n' '\n' - ' Note: When formatting a number ("int", "float", ' - '"complex",\n' + ' Note:\n' + '\n' + ' When formatting a number ("int", "float", "complex",\n' ' "decimal.Decimal" and subclasses) with the "n" type ' '(ex:\n' ' "\'{:n}\'.format(1234)"), the function temporarily ' @@ -10956,17 +11017,20 @@ topics = {'assert': 'The "assert" statement\n' '\n' '2. Unlike in Standard C, exactly two hex digits are required.\n' '\n' - '3. In a bytes literal, hexadecimal and octal escapes denote the\n' - ' byte with the given value. In a string literal, these escapes\n' - ' denote a Unicode character with the given value.\n' + '3. In a bytes literal, hexadecimal and octal escapes denote the ' + 'byte\n' + ' with the given value. In a string literal, these escapes ' + 'denote a\n' + ' Unicode character with the given value.\n' '\n' '4. Changed in version 3.3: Support for name aliases [1] has been\n' ' added.\n' '\n' '5. Exactly four hex digits are required.\n' '\n' - '6. Any Unicode character can be encoded this way. Exactly eight\n' - ' hex digits are required.\n' + '6. Any Unicode character can be encoded this way. Exactly eight ' + 'hex\n' + ' digits are required.\n' '\n' 'Unlike Standard C, all unrecognized escape sequences are left in ' 'the\n' @@ -12664,9 +12728,11 @@ topics = {'assert': 'The "assert" statement\n' '\n' ' Changed in version 3.8: Dictionaries are now reversible.\n' '\n' - 'See also: "types.MappingProxyType" can be used to create a ' - 'read-only\n' - ' view of a "dict".\n' + 'See also:\n' + '\n' + ' "types.MappingProxyType" can be used to create a read-only ' + 'view of a\n' + ' "dict".\n' '\n' '\n' 'Dictionary view objects\n' @@ -13050,13 +13116,14 @@ topics = {'assert': 'The "assert" statement\n' '"None", it\n' ' is treated like "1".\n' '\n' - '6. Concatenating immutable sequences always results in a new\n' - ' object. This means that building up a sequence by repeated\n' - ' concatenation will have a quadratic runtime cost in the ' - 'total\n' - ' sequence length. To get a linear runtime cost, you must ' - 'switch to\n' - ' one of the alternatives below:\n' + '6. Concatenating immutable sequences always results in a new ' + 'object.\n' + ' This means that building up a sequence by repeated ' + 'concatenation\n' + ' will have a quadratic runtime cost in the total sequence ' + 'length.\n' + ' To get a linear runtime cost, you must switch to one of the\n' + ' alternatives below:\n' '\n' ' * if concatenating "str" objects, you can build a list and ' 'use\n' @@ -13074,24 +13141,25 @@ topics = {'assert': 'The "assert" statement\n' ' * for other types, investigate the relevant class ' 'documentation\n' '\n' - '7. Some sequence types (such as "range") only support item\n' - ' sequences that follow specific patterns, and hence don’t ' - 'support\n' - ' sequence concatenation or repetition.\n' - '\n' - '8. "index" raises "ValueError" when *x* is not found in *s*. ' - 'Not\n' - ' all implementations support passing the additional arguments ' - '*i*\n' - ' and *j*. These arguments allow efficient searching of ' - 'subsections\n' - ' of the sequence. Passing the extra arguments is roughly ' - 'equivalent\n' - ' to using "s[i:j].index(x)", only without copying any data and ' - 'with\n' - ' the returned index being relative to the start of the ' + '7. Some sequence types (such as "range") only support item ' + 'sequences\n' + ' that follow specific patterns, and hence don’t support ' 'sequence\n' - ' rather than the start of the slice.\n' + ' concatenation or repetition.\n' + '\n' + '8. "index" raises "ValueError" when *x* is not found in *s*. Not ' + 'all\n' + ' implementations support passing the additional arguments *i* ' + 'and\n' + ' *j*. These arguments allow efficient searching of subsections ' + 'of\n' + ' the sequence. Passing the extra arguments is roughly ' + 'equivalent to\n' + ' using "s[i:j].index(x)", only without copying any data and ' + 'with the\n' + ' returned index being relative to the start of the sequence ' + 'rather\n' + ' than the start of the slice.\n' '\n' '\n' 'Immutable Sequence Types\n' @@ -13219,17 +13287,17 @@ topics = {'assert': 'The "assert" statement\n' '1. *t* must have the same length as the slice it is replacing.\n' '\n' '2. The optional argument *i* defaults to "-1", so that by ' - 'default\n' - ' the last item is removed and returned.\n' + 'default the\n' + ' last item is removed and returned.\n' '\n' '3. "remove()" raises "ValueError" when *x* is not found in *s*.\n' '\n' - '4. The "reverse()" method modifies the sequence in place for\n' - ' economy of space when reversing a large sequence. To remind ' - 'users\n' - ' that it operates by side effect, it does not return the ' - 'reversed\n' - ' sequence.\n' + '4. The "reverse()" method modifies the sequence in place for ' + 'economy\n' + ' of space when reversing a large sequence. To remind users ' + 'that it\n' + ' operates by side effect, it does not return the reversed ' + 'sequence.\n' '\n' '5. "clear()" and "copy()" are included for consistency with the\n' ' interfaces of mutable containers that don’t support slicing\n' @@ -13266,9 +13334,9 @@ topics = {'assert': 'The "assert" statement\n' ' * Using a pair of square brackets to denote the empty list: ' '"[]"\n' '\n' - ' * Using square brackets, separating items with commas: ' - '"[a]",\n' - ' "[a, b, c]"\n' + ' * Using square brackets, separating items with commas: "[a]", ' + '"[a,\n' + ' b, c]"\n' '\n' ' * Using a list comprehension: "[x for x in iterable]"\n' '\n' @@ -13571,9 +13639,9 @@ topics = {'assert': 'The "assert" statement\n' '\n' 'See also:\n' '\n' - ' * The linspace recipe shows how to implement a lazy version ' - 'of\n' - ' range suitable for floating point applications.\n', + ' * The linspace recipe shows how to implement a lazy version of ' + 'range\n' + ' suitable for floating point applications.\n', 'typesseq-mutable': 'Mutable Sequence Types\n' '**********************\n' '\n' @@ -13684,19 +13752,18 @@ topics = {'assert': 'The "assert" statement\n' 'replacing.\n' '\n' '2. The optional argument *i* defaults to "-1", so that ' - 'by default\n' - ' the last item is removed and returned.\n' + 'by default the\n' + ' last item is removed and returned.\n' '\n' '3. "remove()" raises "ValueError" when *x* is not found ' 'in *s*.\n' '\n' '4. The "reverse()" method modifies the sequence in place ' - 'for\n' - ' economy of space when reversing a large sequence. To ' - 'remind users\n' - ' that it operates by side effect, it does not return ' - 'the reversed\n' - ' sequence.\n' + 'for economy\n' + ' of space when reversing a large sequence. To remind ' + 'users that it\n' + ' operates by side effect, it does not return the ' + 'reversed sequence.\n' '\n' '5. "clear()" and "copy()" are included for consistency ' 'with the\n' @@ -13779,8 +13846,9 @@ topics = {'assert': 'The "assert" statement\n' 'The execution of the "with" statement with one “item” proceeds as\n' 'follows:\n' '\n' - '1. The context expression (the expression given in the "with_item")\n' - ' is evaluated to obtain a context manager.\n' + '1. The context expression (the expression given in the "with_item") ' + 'is\n' + ' evaluated to obtain a context manager.\n' '\n' '2. The context manager’s "__enter__()" is loaded for later use.\n' '\n' @@ -13788,12 +13856,15 @@ topics = {'assert': 'The "assert" statement\n' '\n' '4. The context manager’s "__enter__()" method is invoked.\n' '\n' - '5. If a target was included in the "with" statement, the return\n' - ' value from "__enter__()" is assigned to it.\n' + '5. If a target was included in the "with" statement, the return ' + 'value\n' + ' from "__enter__()" is assigned to it.\n' + '\n' + ' Note:\n' '\n' - ' Note: The "with" statement guarantees that if the "__enter__()"\n' - ' method returns without an error, then "__exit__()" will always ' - 'be\n' + ' The "with" statement guarantees that if the "__enter__()" ' + 'method\n' + ' returns without an error, then "__exit__()" will always be\n' ' called. Thus, if an error occurs during the assignment to the\n' ' target list, it will be treated the same as an error occurring\n' ' within the suite would be. See step 6 below.\n' diff --git a/Misc/NEWS.d/3.9.0.rst b/Misc/NEWS.d/3.9.0.rst new file mode 100644 index 0000000..5358b01 --- /dev/null +++ b/Misc/NEWS.d/3.9.0.rst @@ -0,0 +1,57 @@ +.. bpo: 41815 +.. date: 2020-09-19-23-14-54 +.. nonce: RNpuX3 +.. release date: 2020-10-04 +.. section: Library + +Fix SQLite3 segfault when backing up closed database. Patch contributed by +Peter David McCormick. + +.. + +.. bpo: 41662 +.. date: 2020-08-30-21-38-57 +.. nonce: 6e9iZn +.. section: Library + +No longer override exceptions raised in ``__len__()`` of a sequence of +parameters in :mod:`sqlite3` with :exc:`~sqlite3.ProgrammingError`. + +.. + +.. bpo: 41662 +.. date: 2020-08-29-16-07-36 +.. nonce: Mn79zh +.. section: Library + +Fixed crash when mutate list of parameters during iteration in +:mod:`sqlite3`. + +.. + +.. bpo: 39728 +.. date: 2020-02-24-10-58-34 +.. nonce: kOOaHn +.. section: Library + +fix default `_missing_` so a duplicate `ValueError` is not set as the +`__context__` of the original `ValueError` + +.. + +.. bpo: 41602 +.. date: 2020-08-25-19-25-36 +.. nonce: Z64s0I +.. section: Tests + +Add tests for SIGINT handling in the runpy module. + +.. + +.. bpo: 38249 +.. date: 2020-09-28-21-56-51 +.. nonce: uzMCaZ +.. section: Build + +Update :c:macro:`Py_UNREACHABLE` to use __builtin_unreachable() if only the +compiler is able to use it. Patch by Dong-hee Na. diff --git a/Misc/NEWS.d/next/Build/2020-09-28-21-56-51.bpo-38249.uzMCaZ.rst b/Misc/NEWS.d/next/Build/2020-09-28-21-56-51.bpo-38249.uzMCaZ.rst deleted file mode 100644 index 3e409ec..0000000 --- a/Misc/NEWS.d/next/Build/2020-09-28-21-56-51.bpo-38249.uzMCaZ.rst +++ /dev/null @@ -1,2 +0,0 @@ -Update :c:macro:`Py_UNREACHABLE` to use __builtin_unreachable() if only the -compiler is able to use it. Patch by Dong-hee Na. diff --git a/Misc/NEWS.d/next/Library/2020-02-24-10-58-34.bpo-39728.kOOaHn.rst b/Misc/NEWS.d/next/Library/2020-02-24-10-58-34.bpo-39728.kOOaHn.rst deleted file mode 100644 index beb2016..0000000 --- a/Misc/NEWS.d/next/Library/2020-02-24-10-58-34.bpo-39728.kOOaHn.rst +++ /dev/null @@ -1 +0,0 @@ -fix default `_missing_` so a duplicate `ValueError` is not set as the `__context__` of the original `ValueError` diff --git a/Misc/NEWS.d/next/Library/2020-08-29-16-07-36.bpo-41662.Mn79zh.rst b/Misc/NEWS.d/next/Library/2020-08-29-16-07-36.bpo-41662.Mn79zh.rst deleted file mode 100644 index 0571c2d..0000000 --- a/Misc/NEWS.d/next/Library/2020-08-29-16-07-36.bpo-41662.Mn79zh.rst +++ /dev/null @@ -1 +0,0 @@ -Fixed crash when mutate list of parameters during iteration in :mod:`sqlite3`. diff --git a/Misc/NEWS.d/next/Library/2020-08-30-21-38-57.bpo-41662.6e9iZn.rst b/Misc/NEWS.d/next/Library/2020-08-30-21-38-57.bpo-41662.6e9iZn.rst deleted file mode 100644 index aecb0a1..0000000 --- a/Misc/NEWS.d/next/Library/2020-08-30-21-38-57.bpo-41662.6e9iZn.rst +++ /dev/null @@ -1,2 +0,0 @@ -No longer override exceptions raised in ``__len__()`` of a sequence of -parameters in :mod:`sqlite3` with :exc:`~sqlite3.ProgrammingError`. diff --git a/Misc/NEWS.d/next/Library/2020-09-19-23-14-54.bpo-41815.RNpuX3.rst b/Misc/NEWS.d/next/Library/2020-09-19-23-14-54.bpo-41815.RNpuX3.rst deleted file mode 100644 index 3560db9..0000000 --- a/Misc/NEWS.d/next/Library/2020-09-19-23-14-54.bpo-41815.RNpuX3.rst +++ /dev/null @@ -1,2 +0,0 @@ -Fix SQLite3 segfault when backing up closed database. Patch contributed by -Peter David McCormick. diff --git a/Misc/NEWS.d/next/Tests/2020-08-25-19-25-36.bpo-41602.Z64s0I.rst b/Misc/NEWS.d/next/Tests/2020-08-25-19-25-36.bpo-41602.Z64s0I.rst deleted file mode 100644 index fa3d2f1..0000000 --- a/Misc/NEWS.d/next/Tests/2020-08-25-19-25-36.bpo-41602.Z64s0I.rst +++ /dev/null @@ -1 +0,0 @@ -Add tests for SIGINT handling in the runpy module. @@ -1,5 +1,5 @@ -This is Python version 3.9.0 release candidate 2 -================================================ +This is Python version 3.9.0 +============================ .. image:: https://travis-ci.org/python/cpython.svg?branch=3.9 :alt: CPython build status on Travis CI |