Commit 314253c
committed
bytearray_resize_lock_held always initializes ob_bytes_object if NULL
There are several ways that bytearray_resize_lock_held gets called
and for any of them, ob_bytes_object may be NULL.
This allows us to remove the extra initialization in __init__ as
this can't be guaranteed to be called anyway.
Handle a related issue in take_bytes where in the extreme case
of the bytes resize allocation failing (on a size reduction)
then the bytearray other state fileds could be left inconsistent with
a null ob_bytes_object.
unconditionally call _canresize in __init__ as on
initial creation, this will always be true,
and if there are any exported views, then we just
always fail, even if technically an empty bytearray
doesn't get modified in this case, it's so rare, it's not worth it.1 parent b54ca0f commit 314253c
2 files changed
Lines changed: 109 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
2198 | 2198 | | |
2199 | 2199 | | |
2200 | 2200 | | |
| 2201 | + | |
| 2202 | + | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 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 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
2201 | 2280 | | |
2202 | 2281 | | |
2203 | 2282 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
216 | 225 | | |
217 | 226 | | |
218 | 227 | | |
| |||
236 | 245 | | |
237 | 246 | | |
238 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
239 | 257 | | |
240 | 258 | | |
241 | 259 | | |
| |||
920 | 938 | | |
921 | 939 | | |
922 | 940 | | |
923 | | - | |
924 | | - | |
925 | | - | |
926 | | - | |
927 | | - | |
| 941 | + | |
| 942 | + | |
928 | 943 | | |
929 | 944 | | |
930 | | - | |
931 | | - | |
932 | | - | |
933 | | - | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
934 | 949 | | |
935 | 950 | | |
936 | | - | |
| 951 | + | |
937 | 952 | | |
938 | 953 | | |
939 | 954 | | |
| |||
1607 | 1622 | | |
1608 | 1623 | | |
1609 | 1624 | | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
1610 | 1629 | | |
1611 | 1630 | | |
1612 | 1631 | | |
| |||
0 commit comments