Commit aa0de5d
[mypyc] Fix debug warnings/assertions from vecs (#21373)
Two issues found by running the `vecs` tests with a debug build of
python:
Fix assertion `PyObject_GC_Track() object is not valid` caused by
calling the track function on vec buffers before their items are
initialized. We have an optimization in place that doesn't immediately
zero-initialize the buffers because they are set to their actual values
right after calling the allocator. But that makes the GC track garbage
memory so move the track function calls to after the items are
initialized.
Fix resource warning about calling `PyObject_GC_Del` on
`vec_generic_alias` objects. We were missing a `PyObject_GC_UnTrack`
call in the deallocator.
---------
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>1 parent f60d40b commit aa0de5d
3 files changed
Lines changed: 32 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | | - | |
24 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
25 | 30 | | |
26 | 31 | | |
27 | 32 | | |
| |||
31 | 36 | | |
32 | 37 | | |
33 | 38 | | |
34 | | - | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
| 86 | + | |
82 | 87 | | |
83 | 88 | | |
84 | 89 | | |
| |||
122 | 127 | | |
123 | 128 | | |
124 | 129 | | |
| 130 | + | |
125 | 131 | | |
126 | 132 | | |
127 | 133 | | |
| |||
155 | 161 | | |
156 | 162 | | |
157 | 163 | | |
| 164 | + | |
158 | 165 | | |
159 | 166 | | |
160 | 167 | | |
| |||
280 | 287 | | |
281 | 288 | | |
282 | 289 | | |
| 290 | + | |
283 | 291 | | |
284 | 292 | | |
285 | 293 | | |
| |||
381 | 389 | | |
382 | 390 | | |
383 | 391 | | |
| 392 | + | |
384 | 393 | | |
385 | 394 | | |
386 | 395 | | |
| |||
679 | 688 | | |
680 | 689 | | |
681 | 690 | | |
| 691 | + | |
682 | 692 | | |
683 | 693 | | |
684 | 694 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | 27 | | |
29 | 28 | | |
30 | 29 | | |
31 | | - | |
32 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
33 | 39 | | |
34 | 40 | | |
35 | 41 | | |
| |||
51 | 57 | | |
52 | 58 | | |
53 | 59 | | |
| 60 | + | |
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
| |||
93 | 100 | | |
94 | 101 | | |
95 | 102 | | |
| 103 | + | |
96 | 104 | | |
97 | 105 | | |
98 | 106 | | |
| |||
143 | 151 | | |
144 | 152 | | |
145 | 153 | | |
| 154 | + | |
146 | 155 | | |
147 | 156 | | |
148 | 157 | | |
| |||
180 | 189 | | |
181 | 190 | | |
182 | 191 | | |
| 192 | + | |
183 | 193 | | |
184 | 194 | | |
185 | 195 | | |
| |||
260 | 270 | | |
261 | 271 | | |
262 | 272 | | |
| 273 | + | |
263 | 274 | | |
264 | 275 | | |
265 | 276 | | |
| |||
294 | 305 | | |
295 | 306 | | |
296 | 307 | | |
| 308 | + | |
297 | 309 | | |
298 | 310 | | |
299 | 311 | | |
| |||
361 | 373 | | |
362 | 374 | | |
363 | 375 | | |
| 376 | + | |
364 | 377 | | |
365 | 378 | | |
366 | 379 | | |
| |||
405 | 418 | | |
406 | 419 | | |
407 | 420 | | |
| 421 | + | |
408 | 422 | | |
409 | 423 | | |
410 | 424 | | |
| |||
680 | 694 | | |
681 | 695 | | |
682 | 696 | | |
| 697 | + | |
683 | 698 | | |
684 | 699 | | |
685 | 700 | | |
| |||
0 commit comments