summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2003-05-22 16:22:33 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2003-05-22 16:22:33 (GMT)
commitf9415e62458226dbbf90d3a4adea2d60bebae606 (patch)
treeed24cd00ae4499cd280213d8f0a61faa8c0313d8
parent521482d84f2f66949dc9824703c6ea3dad8d6f9c (diff)
downloadcpython-f9415e62458226dbbf90d3a4adea2d60bebae606.zip
cpython-f9415e62458226dbbf90d3a4adea2d60bebae606.tar.gz
cpython-f9415e62458226dbbf90d3a4adea2d60bebae606.tar.bz2
Use macro to get length of list.
Remove comment about how code used to work.
-rw-r--r--Python/compile.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 8c051bc..7e8631d 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -4967,15 +4967,9 @@ symtable_update_free_vars(struct symtable *st)
for (i = 0; i < PyList_GET_SIZE(ste->ste_children); ++i) {
int pos = 0;
- if (list)
- if (PyList_SetSlice(list, 0,
- ((PyVarObject*)list)->ob_size, 0) < 0)
+ if (list && PyList_SetSlice(list, 0,
+ PyList_GET_SIZE(list), 0) < 0)
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 *)
PyList_GET_ITEM(ste->ste_children, i);
while (PyDict_Next(child->ste_symbols, &pos, &name, &o)) {