Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f9415e6

Browse files
committed
Use macro to get length of list.
Remove comment about how code used to work.
1 parent 521482d commit f9415e6

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

Python/compile.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4967,15 +4967,9 @@ symtable_update_free_vars(struct symtable *st)
49674967
for (i = 0; i < PyList_GET_SIZE(ste->ste_children); ++i) {
49684968
int pos = 0;
49694969

4970-
if (list)
4971-
if (PyList_SetSlice(list, 0,
4972-
((PyVarObject*)list)->ob_size, 0) < 0)
4970+
if (list && PyList_SetSlice(list, 0,
4971+
PyList_GET_SIZE(list), 0) < 0)
49734972
return -1;
4974-
/* Yes, the above call CAN fail, even though it's reducing
4975-
the size of the list. The current implementation will
4976-
allocate temp memory equal to the size of the list: this
4977-
is avoidable in this specific case, but probably not
4978-
worth the effort of special-casing it. - JRH */
49794973
child = (PySymtableEntryObject *)
49804974
PyList_GET_ITEM(ste->ste_children, i);
49814975
while (PyDict_Next(child->ste_symbols, &pos, &name, &o)) {

0 commit comments

Comments
 (0)