diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2023-04-22 16:32:47 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-22 16:32:47 (GMT) |
commit | 3d2a46845b67407e2436d910b2e1740c34f4f10d (patch) | |
tree | 607d43aa0a30a293fcffc2623453cc7787687edd /Misc | |
parent | caed49448d195565940caf198cf0edda65ee5679 (diff) | |
download | cpython-3d2a46845b67407e2436d910b2e1740c34f4f10d.zip cpython-3d2a46845b67407e2436d910b2e1740c34f4f10d.tar.gz cpython-3d2a46845b67407e2436d910b2e1740c34f4f10d.tar.bz2 |
gh-83791: Raise TypeError for len(memoryview_0d) (#18463)
Changes the behaviour of `len` on a zero-dimensional `memoryview` to raise `TypeError`. Previously, `len` would return `1`.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Core and Builtins/2020-02-11-15-54-40.bpo-39610.fvgsCl.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-02-11-15-54-40.bpo-39610.fvgsCl.rst b/Misc/NEWS.d/next/Core and Builtins/2020-02-11-15-54-40.bpo-39610.fvgsCl.rst new file mode 100644 index 0000000..d65e0f3 --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2020-02-11-15-54-40.bpo-39610.fvgsCl.rst @@ -0,0 +1,2 @@ +``len()`` for 0-dimensional :class:`memoryview`` objects (such as ``memoryview(ctypes.c_uint8(42))``) now raises a :exc:`TypeError`.
+Previously this returned ``1``, which was not consistent with ``mem_0d[0]`` raising an :exc:`IndexError``.
|