Commit 2208f6a
pythongh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (pythonGH-5576)
The itemsize returned in a memoryview of a ctypes array is now computed from the item type, instead of dividing the total size by the length and assuming that the length is not zero.
(cherry picked from commit 84bc6a4)
Co-authored-by: Eric Wieser <wieser.eric@gmail.com>1 parent 86cdfaa commit 2208f6a
3 files changed
Lines changed: 30 additions & 8 deletions
File tree
- Lib/ctypes/test
- Misc/NEWS.d/next/Core and Builtins
- Modules/_ctypes
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
179 | 180 | | |
| 181 | + | |
180 | 182 | | |
181 | 183 | | |
182 | 184 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2795 | 2795 | | |
2796 | 2796 | | |
2797 | 2797 | | |
2798 | | - | |
| 2798 | + | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
2799 | 2820 | | |
2800 | 2821 | | |
2801 | 2822 | | |
2802 | | - | |
| 2823 | + | |
| 2824 | + | |
2803 | 2825 | | |
2804 | 2826 | | |
2805 | 2827 | | |
| |||
2812 | 2834 | | |
2813 | 2835 | | |
2814 | 2836 | | |
2815 | | - | |
2816 | | - | |
2817 | | - | |
2818 | | - | |
2819 | | - | |
2820 | | - | |
| 2837 | + | |
2821 | 2838 | | |
2822 | 2839 | | |
2823 | 2840 | | |
| |||
0 commit comments