Skip to content

Commit

Permalink
Fix documentation build
Browse files Browse the repository at this point in the history
  • Loading branch information
eric-wieser committed Jul 7, 2022
1 parent 209644d commit dbad24a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 4 additions & 3 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3693,9 +3693,10 @@ copying.
``len(view)`` is equal to the length of :class:`~memoryview.tolist`, which
is the nested list representation of the view. If ``view.ndim = 1``,
this is equal to the number of elements in the view.

.. versionchanged:: 3.10
If ``view.ndim = 0``, ``len(view)`` now raises `TypeError` instead of returning 1.

.. versionchanged:: 3.11
If ``view.ndim == 0``, ``len(view)`` now raises :exc:`TypeError` instead of returning 1.

The :class:`~memoryview.itemsize` attribute will give you the number of
bytes in a single element.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,2 @@
0d ``memoryview`` objects no longer have a ``len``::

>>> import ctypes
>>> mem_0d = memoryview(ctypes.c_uint8(42))
>>> len(mem_0d)
TypeError: ...

Previously this returned ``1``, which was not consistent with the behavior of ``mem_0d[0]``.
``len()`` for 0-dimensional ``memoryview`` objects (such as ``memoryview(ctypes.c_uint8(42))``) now raises a ``TypeError``.
Previously this returned ``1``, which was not consistent with ``mem_0d[0]`` raising an ``IndexError``.

0 comments on commit dbad24a

Please sign in to comment.