Commit ef15bd9
committed
gh-150942: Speed up asyncio Future.remove_done_callback
Use _PyList_AppendTakeRef instead of PyList_Append to avoid an
extra incref/decref pair when compaction appends callbacks to the
new list.
The item is already owned (Py_INCREF was called earlier in the loop),
so _PyList_AppendTakeRef takes ownership of that reference directly
without incrementing it again.1 parent 5a400ce commit ef15bd9
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1202 | 1202 | | |
1203 | 1203 | | |
1204 | 1204 | | |
1205 | | - | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
1206 | 1209 | | |
1207 | | - | |
1208 | 1210 | | |
1209 | 1211 | | |
1210 | 1212 | | |
| |||
0 commit comments