Skip to content

Commit

Permalink
Allow passing only item_type to create_memory_object_stream() (agronh…
Browse files Browse the repository at this point in the history
  • Loading branch information
gschaffner committed Oct 14, 2022
1 parent f080174 commit 3b03178
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/versionhistory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This library adheres to `Semantic Versioning 2.0 <http:https://semver.org/>`_.
- The ``TaskStatus`` class is now generic, and should be parametrized to indicate the
type of the value passed to ``task_status.started()``
- The ``Listener`` class is now covariant in its stream type
- ``create_memory_object_stream()`` now allows passing only ``item_type``
- Fixed ``CapacityLimiter`` on the asyncio backend to order waiting tasks in the FIFO
order (instead of LIFO) (PR by Conor Stevenson)
- Fixed ``CancelScope.cancel()`` not working on asyncio if called before entering the
Expand Down
8 changes: 4 additions & 4 deletions src/anyio/_core/_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

@overload
def create_memory_object_stream(
max_buffer_size: float, item_type: type[T_Item]
) -> tuple[MemoryObjectSendStream[T_Item], MemoryObjectReceiveStream[T_Item]]:
max_buffer_size: float = 0,
) -> tuple[MemoryObjectSendStream[Any], MemoryObjectReceiveStream[Any]]:
...


@overload
def create_memory_object_stream(
max_buffer_size: float = 0,
) -> tuple[MemoryObjectSendStream[Any], MemoryObjectReceiveStream[Any]]:
max_buffer_size: float = 0, item_type: type[T_Item] = ...
) -> tuple[MemoryObjectSendStream[T_Item], MemoryObjectReceiveStream[T_Item]]:
...


Expand Down

0 comments on commit 3b03178

Please sign in to comment.