Commit f6fe4bb
gh-76963: PEP3118 itemsize of an empty ctypes array should not be 0 (GH-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 1fa4c6b commit f6fe4bb
File tree
3 files changed
+30
-8
lines changed- Lib/ctypes/test
- Misc/NEWS.d/next/Core and Builtins
- Modules/_ctypes
3 files changed
+30
-8
lines changed| 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 | |
|---|---|---|---|
| |||
2775 | 2775 | | |
2776 | 2776 | | |
2777 | 2777 | | |
2778 | | - | |
| 2778 | + | |
| 2779 | + | |
| 2780 | + | |
| 2781 | + | |
| 2782 | + | |
| 2783 | + | |
| 2784 | + | |
| 2785 | + | |
| 2786 | + | |
| 2787 | + | |
| 2788 | + | |
| 2789 | + | |
| 2790 | + | |
| 2791 | + | |
| 2792 | + | |
| 2793 | + | |
| 2794 | + | |
| 2795 | + | |
| 2796 | + | |
| 2797 | + | |
| 2798 | + | |
| 2799 | + | |
2779 | 2800 | | |
2780 | 2801 | | |
2781 | 2802 | | |
2782 | | - | |
| 2803 | + | |
| 2804 | + | |
2783 | 2805 | | |
2784 | 2806 | | |
2785 | 2807 | | |
| |||
2792 | 2814 | | |
2793 | 2815 | | |
2794 | 2816 | | |
2795 | | - | |
2796 | | - | |
2797 | | - | |
2798 | | - | |
2799 | | - | |
2800 | | - | |
| 2817 | + | |
2801 | 2818 | | |
2802 | 2819 | | |
2803 | 2820 | | |
| |||
0 commit comments