Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork3.1k
Commit9b9272a
authored
[mypyc] Don't explicitly assign
While investigating something unrelated I stumbled across the `*_setup`functions, and I noticed that they contain a lot of code that looks likethis:```cself->abc = NULL;self->xyz = NULL;// ...```Something told me that assigning `NULL` to a bunch of fields is propablynot needed, and when looking at the docs for `tp_alloc()` I found thisreference to[`allocfunc`](https://docs.python.org/3/c-api/typeobj.html#c.allocfunc),the typedef for `tp_alloc()`:> It should return a pointer to a block of memory of adequate length forthe instance, suitably aligned, ***and initialized to zeros***, ...Emphasis is mine.Basically I added a simple check that removes lines that assigns `NULL`values in setup functions. This removes about ~4100 lines from the Cfile when self-compiling.NULL values in setup functions (#15379)1 parent4aa18ea commit9b9272a
1 file changed
+6
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
578 | 578 | | |
579 | 579 | | |
580 | 580 | | |
581 | | - | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
582 | 587 | | |
583 | 588 | | |
584 | 589 | | |
| |||
0 commit comments
Comments
(0)