mirror of
https://github.com/python/cpython.git
synced 2025-10-22 06:32:43 +00:00
Use macro to get length of list.
Remove comment about how code used to work.
This commit is contained in:
parent
521482d84f
commit
f9415e6245
1 changed files with 2 additions and 8 deletions
|
@ -4967,15 +4967,9 @@ symtable_update_free_vars(struct symtable *st)
|
||||||
for (i = 0; i < PyList_GET_SIZE(ste->ste_children); ++i) {
|
for (i = 0; i < PyList_GET_SIZE(ste->ste_children); ++i) {
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
if (list)
|
if (list && PyList_SetSlice(list, 0,
|
||||||
if (PyList_SetSlice(list, 0,
|
PyList_GET_SIZE(list), 0) < 0)
|
||||||
((PyVarObject*)list)->ob_size, 0) < 0)
|
|
||||||
return -1;
|
return -1;
|
||||||
/* Yes, the above call CAN fail, even though it's reducing
|
|
||||||
the size of the list. The current implementation will
|
|
||||||
allocate temp memory equal to the size of the list: this
|
|
||||||
is avoidable in this specific case, but probably not
|
|
||||||
worth the effort of special-casing it. - JRH */
|
|
||||||
child = (PySymtableEntryObject *)
|
child = (PySymtableEntryObject *)
|
||||||
PyList_GET_ITEM(ste->ste_children, i);
|
PyList_GET_ITEM(ste->ste_children, i);
|
||||||
while (PyDict_Next(child->ste_symbols, &pos, &name, &o)) {
|
while (PyDict_Next(child->ste_symbols, &pos, &name, &o)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue