Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
86eeeb4
Doc: fix a rst tag. (GH-26965)
JulienPalard Jun 30, 2021
139de04
bpo-41180: Replace marshal code.__new__ audit event with marshal.load…
zooba Jun 30, 2021
95919b0
bpo-41180: Fixes documentation to specify correct event name and add …
zooba Jun 30, 2021
d3a95c1
bpo-44535: Enable building with Visual Studio 2022 on Windows (GH-26962)
zooba Jun 30, 2021
66c53b4
Fix compiler errors for unused variables in marshal.c (GH-26977)
pablogsal Jun 30, 2021
1b28187
bpo-44313: generate LOAD_ATTR/CALL_FUNCTION for top-level imported ob…
isidentical Jun 30, 2021
818628c
bpo-44531: Add _PyType_AllocNoTrack() function (GH-26947)
vstinner Jul 1, 2021
c8979f7
bpo-43425: Update _osx_support not to use distutils.log (GH-26968)
corona10 Jul 1, 2021
dd3adc0
bpo-43770: Cleanup _PyObject_GetMethod() (GH-26946)
vstinner Jul 1, 2021
3623aaa
Add file describing how to add or modify specialized families of inst…
markshannon Jul 1, 2021
a1092f6
bpo-43216: Remove @asyncio.coroutine (GH-26369)
illia-v Jul 1, 2021
ddd5f36
bpo-43234: Prohibit non-ThreadPoolExecutor in loop.set_default_execut…
illia-v Jul 1, 2021
0d7f61d
bpo-44313: bump up magic (#26983)
isidentical Jul 1, 2021
a7e251b
bpo-43425: Update setup.py not to use distutils.log (GH-26969)
corona10 Jul 2, 2021
85b9204
bpo-30256: Add manager_owned keyword arg to AutoProxy (GH-16341)
finefoot Jul 2, 2021
943e77d
bpo-34798: [doc] clearer presentation of pprint.PrettyPrinter constru…
iritkatriel Jul 2, 2021
98eee94
bpo-43950: Add code.co_positions (PEP 657) (GH-26955)
pablogsal Jul 2, 2021
2560c61
bpo-30256: [doc] Fix formatting error in news (GH-26994)
Fidget-Spinner Jul 2, 2021
ec8759b
bpo-43950: optimize column table assembling with pre-sizing object (G…
isidentical Jul 2, 2021
4bcef2b
bpo-44388: Update venv EnvBuilder.ensure_directories() docs. (GH-26663)
itsayellow Jul 2, 2021
01331f1
bpo-42238: rstlint: Add two new checks. (GH-26966)
JulienPalard Jul 3, 2021
1097384
bpo-44553 : Implement GC methods for types.Union (GH-26993)
Fidget-Spinner Jul 3, 2021
a79e2b6
Fix a small typo in the docs (GH-26991)
srinivasreddy Jul 3, 2021
556d5ad
bpo-44129: Add descriptive global variables for general purpose bit f…
danifus Jul 3, 2021
d968a63
bpo-34266: [pdb] handle ValueError from shlex.split() (GH-26656)
iritkatriel Jul 3, 2021
bc39614
bpo-44553: Correct failure in tp_new for the union object (GH-27008)
pablogsal Jul 3, 2021
d33943a
bpo-44562: Remove invalid PyObject_GC_Del from error path of types.Ge…
Fidget-Spinner Jul 4, 2021
44f91fc
bpo-43950: use 0-indexed column offsets for bytecode positions (GH-27…
isidentical Jul 4, 2021
693cec0
bpo-43950: include position in dis.Instruction (GH-27015)
isidentical Jul 4, 2021
5644c7b
bpo-43950: Print columns in tracebacks (PEP 657) (GH-26958)
ammaraskar Jul 4, 2021
a9a69bb
bpo-41486: zlib uses an UINT32_MAX sliding window for the output buff…
animalize Jul 5, 2021
abb08e3
bpo-44534: fix wording and docstring sync in unittest.Mock GH27000
jdevries3133 Jul 5, 2021
0930240
bpo-44558: Make the implementation consistency of operator.indexOf (G…
corona10 Jul 5, 2021
b324c4c
bpo-44562: Use PyType_GenericAlloc in Py_GenericAlias (GH-27021)
pablogsal Jul 5, 2021
7ac7a0c
bpo-44022: Fix Sphinx role in NEWS entry (GH-27033)
sir-sigurd Jul 5, 2021
1b133ab
bpo-44479: Regenerate test_frozenmain.h and frozen_hello.h during bui…
zooba Jul 5, 2021
17f94e2
bpo-43453: Update and re-add example to typing runtime_checkable (#27…
akulakov Jul 5, 2021
f64de53
bpo-44563: Fix error handling in tee.fromiterable() (GH-27020)
serhiy-storchaka Jul 5, 2021
8b849ea
bpo-38291: Fix a spurious warning when using help(object) (#27039)
srittau Jul 6, 2021
c45fa1a
bpo-44490: Add __parameters__ and __getitem__ to types.Union (GH-26980)
uriyyo Jul 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Doc/c-api/memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ Customize Memory Allocators
Debug hooks on the Python memory allocators
===========================================

When :ref:`Python is built is debug mode <debug-build>`, the
When :ref:`Python is built in debug mode <debug-build>`, the
:c:func:`PyMem_SetupDebugHooks` function is called at the :ref:`Python
preinitialization <c-preinit>` to setup debug hooks on Python memory allocators
to detect memory errors.
Expand Down
12 changes: 4 additions & 8 deletions Doc/library/asyncio-eventloop.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1132,16 +1132,12 @@ Executing code in thread or process pools
.. method:: loop.set_default_executor(executor)

Set *executor* as the default executor used by :meth:`run_in_executor`.
*executor* should be an instance of
*executor* must be an instance of
:class:`~concurrent.futures.ThreadPoolExecutor`.

.. deprecated:: 3.8
Using an executor that is not an instance of
:class:`~concurrent.futures.ThreadPoolExecutor` is deprecated and
will trigger an error in Python 3.9.

*executor* must be an instance of
:class:`concurrent.futures.ThreadPoolExecutor`.
.. versionchanged:: 3.11
*executor* must be an instance of
:class:`~concurrent.futures.ThreadPoolExecutor`.


Error Handling API
Expand Down
60 changes: 0 additions & 60 deletions Doc/library/asyncio-task.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,6 @@ other coroutines::
* a *coroutine object*: an object returned by calling a
*coroutine function*.

asyncio also supports legacy :ref:`generator-based
<asyncio_generator_based_coro>` coroutines.


.. rubric:: Tasks

Expand Down Expand Up @@ -1042,60 +1039,3 @@ Task Object
in the :func:`repr` output of a task object.

.. versionadded:: 3.8


.. _asyncio_generator_based_coro:

Generator-based Coroutines
==========================

.. note::

Support for generator-based coroutines is **deprecated** and
is scheduled for removal in Python 3.10.

Generator-based coroutines predate async/await syntax. They are
Python generators that use ``yield from`` expressions to await
on Futures and other coroutines.

Generator-based coroutines should be decorated with
:func:`@asyncio.coroutine <asyncio.coroutine>`, although this is not
enforced.


.. decorator:: coroutine

Decorator to mark generator-based coroutines.

This decorator enables legacy generator-based coroutines to be
compatible with async/await code::

@asyncio.coroutine
def old_style_coroutine():
yield from asyncio.sleep(1)

async def main():
await old_style_coroutine()

This decorator should not be used for :keyword:`async def`
coroutines.

.. deprecated-removed:: 3.8 3.10

Use :keyword:`async def` instead.

.. function:: iscoroutine(obj)

Return ``True`` if *obj* is a :ref:`coroutine object <coroutine>`.

This method is different from :func:`inspect.iscoroutine` because
it returns ``True`` for generator-based coroutines.

.. function:: iscoroutinefunction(func)

Return ``True`` if *func* is a :ref:`coroutine function
<coroutine>`.

This method is different from :func:`inspect.iscoroutinefunction`
because it returns ``True`` for generator-based coroutine functions
decorated with :func:`@coroutine <coroutine>`.
4 changes: 2 additions & 2 deletions Doc/library/collections.abc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ ABC Inherits from Abstract Methods Mixin

.. note::
In CPython, generator-based coroutines (generators decorated with
:func:`types.coroutine` or :func:`asyncio.coroutine`) are
:func:`types.coroutine`) are
*awaitables*, even though they do not have an :meth:`__await__` method.
Using ``isinstance(gencoro, Awaitable)`` for them will return ``False``.
Use :func:`inspect.isawaitable` to detect them.
Expand All @@ -216,7 +216,7 @@ ABC Inherits from Abstract Methods Mixin

.. note::
In CPython, generator-based coroutines (generators decorated with
:func:`types.coroutine` or :func:`asyncio.coroutine`) are
:func:`types.coroutine`) are
*awaitables*, even though they do not have an :meth:`__await__` method.
Using ``isinstance(gencoro, Coroutine)`` for them will return ``False``.
Use :func:`inspect.isawaitable` to detect them.
Expand Down
12 changes: 6 additions & 6 deletions Doc/library/contextlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -515,9 +515,9 @@ Functions and classes provided:
These context managers may suppress exceptions just as they normally
would if used directly as part of a :keyword:`with` statement.

... versionchanged:: 3.11
Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm*
is not a context manager.
.. versionchanged:: 3.11
Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm*
is not a context manager.

.. method:: push(exit)

Expand Down Expand Up @@ -589,9 +589,9 @@ Functions and classes provided:
Similar to :meth:`enter_context` but expects an asynchronous context
manager.

... versionchanged:: 3.11
Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm*
is not an asynchronous context manager.
.. versionchanged:: 3.11
Raises :exc:`TypeError` instead of :exc:`AttributeError` if *cm*
is not an asynchronous context manager.

.. method:: push_async_exit(exit)

Expand Down
18 changes: 18 additions & 0 deletions Doc/library/marshal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ The module defines these functions:
The *version* argument indicates the data format that ``dump`` should use
(see below).

.. audit-event:: marshal.dumps value,version marshal.dump


.. function:: load(file)

Expand All @@ -74,11 +76,18 @@ The module defines these functions:
format), raise :exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. The
file must be a readable :term:`binary file`.

.. audit-event:: marshal.load "" marshal.load

.. note::

If an object containing an unsupported type was marshalled with :func:`dump`,
:func:`load` will substitute ``None`` for the unmarshallable type.

.. versionchanged:: 3.10

This call used to raise a ``code.__new__`` audit event for each code object. Now
it raises a single ``marshal.load`` event for the entire load operation.


.. function:: dumps(value[, version])

Expand All @@ -89,13 +98,22 @@ The module defines these functions:
The *version* argument indicates the data format that ``dumps`` should use
(see below).

.. audit-event:: marshal.dumps value,version marshal.dump


.. function:: loads(bytes)

Convert the :term:`bytes-like object` to a value. If no valid value is found, raise
:exc:`EOFError`, :exc:`ValueError` or :exc:`TypeError`. Extra bytes in the
input are ignored.

.. audit-event:: marshal.loads bytes marshal.load

.. versionchanged:: 3.10

This call used to raise a ``code.__new__`` audit event for each code object. Now
it raises a single ``marshal.loads`` event for the entire load operation.


In addition, the following constants are defined:

Expand Down
48 changes: 30 additions & 18 deletions Doc/library/pprint.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,36 @@ The :mod:`pprint` module defines one class:
compact=False, sort_dicts=True, underscore_numbers=False)

Construct a :class:`PrettyPrinter` instance. This constructor understands
several keyword parameters. An output stream may be set using the *stream*
keyword; the only method used on the stream object is the file protocol's
:meth:`write` method. If not specified, the :class:`PrettyPrinter` adopts
``sys.stdout``. The
amount of indentation added for each recursive level is specified by *indent*;
the default is one. Other values can cause output to look a little odd, but can
make nesting easier to spot. The number of levels which may be printed is
controlled by *depth*; if the data structure being printed is too deep, the next
contained level is replaced by ``...``. By default, there is no constraint on
the depth of the objects being formatted. The desired output width is
constrained using the *width* parameter; the default is 80 characters. If a
structure cannot be formatted within the constrained width, a best effort will
be made. If *compact* is false (the default) each item of a long sequence
will be formatted on a separate line. If *compact* is true, as many items
as will fit within the *width* will be formatted on each output line. If
*sort_dicts* is true (the default), dictionaries will be formatted with their
keys sorted, otherwise they will display in insertion order. If
*underscore_numbers* is true, integers will be formatted with the
several keyword parameters.

*stream* (default ``sys.stdout``) is a :term:`file-like object` to
which the output will be written by calling its :meth:`write` method.

Other values configure the manner in which nesting of complex data
structures is displayed.

*indent* (default 1) specifies the amount of indentation added for
each nesting level.

*depth* controls the number of nesting levels which may be printed; if
the data structure being printed is too deep, the next contained level
is replaced by ``...``. By default, there is no constraint on the
depth of the objects being formatted.

*width* (default 80) specifies the desired maximum number of characters per
line in the output. If a structure cannot be formatted within the width
constraint, a best effort will be made.

*compact* impacts the way that long sequences (lists, tuples, sets, etc)
are formatted. If *compact* is false (the default) then each item of a
sequence will be formatted on a separate line. If *compact* is true, as
many items as will fit within the *width* will be formatted on each output
line.

If *sort_dicts* is true (the default), dictionaries will be formatted with
their keys sorted, otherwise they will display in insertion order.

If *underscore_numbers* is true, integers will be formatted with the
``_`` character for a thousands separator, otherwise underscores are not
displayed (the default).

Expand Down
17 changes: 11 additions & 6 deletions Doc/library/traceback.rst
Original file line number Diff line number Diff line change
Expand Up @@ -447,37 +447,42 @@ The output for the example would look similar to this:
*** print_tb:
File "<doctest...>", line 10, in <module>
lumberjack()
^^^^^^^^^^^^
*** print_exception:
Traceback (most recent call last):
File "<doctest...>", line 10, in <module>
lumberjack()
^^^^^^^^^^^^
File "<doctest...>", line 4, in lumberjack
bright_side_of_death()
^^^^^^^^^^^^^^^^^^^^^^
IndexError: tuple index out of range
*** print_exc:
Traceback (most recent call last):
File "<doctest...>", line 10, in <module>
lumberjack()
^^^^^^^^^^^^
File "<doctest...>", line 4, in lumberjack
bright_side_of_death()
^^^^^^^^^^^^^^^^^^^^^^
IndexError: tuple index out of range
*** format_exc, first and last line:
Traceback (most recent call last):
IndexError: tuple index out of range
*** format_exception:
['Traceback (most recent call last):\n',
' File "<doctest...>", line 10, in <module>\n lumberjack()\n',
' File "<doctest...>", line 4, in lumberjack\n bright_side_of_death()\n',
' File "<doctest...>", line 7, in bright_side_of_death\n return tuple()[0]\n',
' File "<doctest default[0]>", line 10, in <module>\n lumberjack()\n ^^^^^^^^^^^^\n',
' File "<doctest default[0]>", line 4, in lumberjack\n bright_side_of_death()\n ^^^^^^^^^^^^^^^^^^^^^^\n',
' File "<doctest default[0]>", line 7, in bright_side_of_death\n return tuple()[0]\n ^^^^^^^^^^\n',
'IndexError: tuple index out of range\n']
*** extract_tb:
[<FrameSummary file <doctest...>, line 10 in <module>>,
<FrameSummary file <doctest...>, line 4 in lumberjack>,
<FrameSummary file <doctest...>, line 7 in bright_side_of_death>]
*** format_tb:
[' File "<doctest...>", line 10, in <module>\n lumberjack()\n',
' File "<doctest...>", line 4, in lumberjack\n bright_side_of_death()\n',
' File "<doctest...>", line 7, in bright_side_of_death\n return tuple()[0]\n']
[' File "<doctest default[0]>", line 10, in <module>\n lumberjack()\n ^^^^^^^^^^^^\n',
' File "<doctest default[0]>", line 4, in lumberjack\n bright_side_of_death()\n ^^^^^^^^^^^^^^^^^^^^^^\n',
' File "<doctest default[0]>", line 7, in bright_side_of_death\n return tuple()[0]\n ^^^^^^^^^^\n']
*** tb_lineno: 10


Expand Down
9 changes: 7 additions & 2 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1232,8 +1232,13 @@ These are not used in annotations. They are building blocks for creating generic

.. note::

:func:`runtime_checkable` will check only the presence of the required methods,
not their type signatures.
:func:`runtime_checkable` will check only the presence of the required
methods, not their type signatures. For example, :class:`ssl.SSLObject`
is a class, therefore it passes an :func:`issubclass`
check against :data:`Callable`. However, the
:meth:`ssl.SSLObject.__init__` method exists only to raise a
:exc:`TypeError` with a more informative message, therefore making
it impossible to call (instantiate) :class:`ssl.SSLObject`.

.. versionadded:: 3.8

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/unittest.mock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ the *new_callable* argument to :func:`patch`.
this is a new Mock (created on first access). See the
:attr:`return_value` attribute.

* *unsafe*: By default, accessing any attribute with name starting with
* *unsafe*: By default, accessing any attribute whose name starts with
*assert*, *assret*, *asert*, *aseert* or *assrt* will raise an
:exc:`AttributeError`. Passing ``unsafe=True`` will allow access to
these attributes.
Expand Down
11 changes: 6 additions & 5 deletions Doc/library/venv.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,12 @@ creation according to their needs, the :class:`EnvBuilder` class.

.. method:: ensure_directories(env_dir)

Creates the environment directory and all necessary directories, and
returns a context object. This is just a holder for attributes (such as
paths), for use by the other methods. The directories are allowed to
exist already, as long as either ``clear`` or ``upgrade`` were
specified to allow operating on an existing environment directory.
Creates the environment directory and all necessary subdirectories that
don't already exist, and returns a context object. This context object
is just a holder for attributes (such as paths) for use by the other
methods. If the :class:`EnvBuilder` is created with the arg
``clear=True``, contents of the environment directory will be cleared
and then all necessary subdirectories will be recreated.

.. method:: create_configuration(context)

Expand Down
2 changes: 1 addition & 1 deletion Doc/reference/datamodel.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2714,7 +2714,7 @@ are awaitable.
.. note::

The :term:`generator iterator` objects returned from generators
decorated with :func:`types.coroutine` or :func:`asyncio.coroutine`
decorated with :func:`types.coroutine`
are also awaitable, but they do not implement :meth:`__await__`.

.. method:: object.__await__(self)
Expand Down
Loading