Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
Revert "Do the same with contextlib references"
Similarly to `collections.abc` changes, this is not acceptable for now.
  • Loading branch information
sterliakov committed Sep 1, 2024
commit fb137364e9dc255547b63a4782b06089ee11b555
14 changes: 2 additions & 12 deletions Doc/library/contextlib.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,18 @@ Utilities

Functions and classes provided:

.. class:: AbstractContextManager[T_co, ExitT_co]
.. class:: AbstractContextManager

An :term:`abstract base class` for classes that implement
:meth:`object.__enter__` and :meth:`object.__exit__`. A default
implementation for :meth:`object.__enter__` is provided which returns
``self`` while :meth:`object.__exit__` is an abstract method which by default
returns ``None``. See also the definition of :ref:`typecontextmanager`.

The first type parameter, ``T_co``, represents the type returned by
the :meth:`~object.__enter__` method. The optional second type parameter, ``ExitT_co``,
which defaults to ``bool | None``, represents the type returned by the
:meth:`~object.__exit__` method.

.. versionadded:: 3.6


.. class:: AbstractAsyncContextManager[T_co, AExitT_co]
.. class:: AbstractAsyncContextManager

An :term:`abstract base class` for classes that implement
:meth:`object.__aenter__` and :meth:`object.__aexit__`. A default
Expand All @@ -43,11 +38,6 @@ Functions and classes provided:
returns ``None``. See also the definition of
:ref:`async-context-managers`.

The first type parameter, ``T_co``, represents the type returned by
the :meth:`~object.__aenter__` method. The optional second type parameter, ``AExitT_co``,
which defaults to ``bool | None``, represents the type returned by the
:meth:`~object.__aexit__` method.

.. versionadded:: 3.7


Expand Down
10 changes: 10 additions & 0 deletions Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3812,6 +3812,11 @@ Aliases to :mod:`contextlib` ABCs

Deprecated alias to :class:`contextlib.AbstractContextManager`.

The first type parameter, ``T_co``, represents the type returned by
the :meth:`~object.__enter__` method. The optional second type parameter, ``ExitT_co``,
which defaults to ``bool | None``, represents the type returned by the
:meth:`~object.__exit__` method.

.. versionadded:: 3.5.4

.. deprecated:: 3.9
Expand All @@ -3826,6 +3831,11 @@ Aliases to :mod:`contextlib` ABCs

Deprecated alias to :class:`contextlib.AbstractAsyncContextManager`.

The first type parameter, ``T_co``, represents the type returned by
the :meth:`~object.__aenter__` method. The optional second type parameter, ``AExitT_co``,
which defaults to ``bool | None``, represents the type returned by the
:meth:`~object.__aexit__` method.

.. versionadded:: 3.6.2

.. deprecated:: 3.9
Expand Down