Commit d5c1b29
Introduce a bytearray_new() function to ensure that
ob_bytes_object is always set on a bytearray.
Resizing a bytearray to 0 length now explicitly sets
the ob_bytes_object to the empty constant immortal.
Add a check in the 'bytearray init from string'
fast path to ensure there are no active exports.
This fixes asserts/crashes on the following:
- bytearray(1).__init__()
- bytearray().__new__(bytearray).append(1)
- a = bytearray(); b = memoryview(a); a.__init__('x', 'ascii')
Co-authored-by: Cody Maloney <cmaloney@users.noreply.github.com>
1 parent d24d9d0 commit d5c1b29
4 files changed
Lines changed: 78 additions & 12 deletions
File tree
- Lib/test
- Misc/NEWS.d/next/Core_and_Builtins
- Objects
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2226 | 2226 | | |
2227 | 2227 | | |
2228 | 2228 | | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
2229 | 2269 | | |
2230 | 2270 | | |
2231 | 2271 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
216 | 219 | | |
217 | 220 | | |
218 | 221 | | |
| |||
236 | 239 | | |
237 | 240 | | |
238 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
239 | 250 | | |
240 | 251 | | |
241 | 252 | | |
| |||
902 | 913 | | |
903 | 914 | | |
904 | 915 | | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
905 | 930 | | |
906 | 931 | | |
907 | 932 | | |
| |||
920 | 945 | | |
921 | 946 | | |
922 | 947 | | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
928 | 952 | | |
929 | 953 | | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
934 | 957 | | |
935 | | - | |
936 | | - | |
937 | 958 | | |
938 | 959 | | |
939 | 960 | | |
| |||
1609 | 1630 | | |
1610 | 1631 | | |
1611 | 1632 | | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
1612 | 1636 | | |
1613 | 1637 | | |
1614 | 1638 | | |
| |||
2939 | 2963 | | |
2940 | 2964 | | |
2941 | 2965 | | |
2942 | | - | |
| 2966 | + | |
2943 | 2967 | | |
2944 | 2968 | | |
2945 | 2969 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3380 | 3380 | | |
3381 | 3381 | | |
3382 | 3382 | | |
| 3383 | + | |
3383 | 3384 | | |
3384 | 3385 | | |
3385 | 3386 | | |
| |||
0 commit comments