[Python-checkins] r45279 - in python/trunk: Parser/pgenmain.c Python/compile.c Python/future.c Python/pyarena.c Python/pystate.c

Jeremy Hylton jeremy at alum.mit.edu
Tue Apr 11 14:21:41 CEST 2006


On 4/11/06, anthony.baxter <python-checkins at python.org> wrote:
> Author: anthony.baxter
> Date: Tue Apr 11 14:01:56 2006
> New Revision: 45279
>
> Modified:
>    python/trunk/Parser/pgenmain.c
>    python/trunk/Python/compile.c
>    python/trunk/Python/future.c
>    python/trunk/Python/pyarena.c
>    python/trunk/Python/pystate.c
> Log:
> more low-hanging fruit. Not entirely happy with the two new VISIT macros in
> compile.c, but I couldn't see a better approach.

Could you provide more descriptive log messages?  I can't fathom what
kind of low-hanging fruit you are talking about.  I'm guessing that
you are dealing with warnings on some compiler, but I don't know which
one or why we didn't see them before.

As for the new visit macros, the second argument to VISIT is the type
of the sequence elements that are being iterated over.  You should be
able to generate a cast from that without passing a separate cast
token.  I can't think of a case where TYPE did not imply CAST.

-       VISIT_SEQ(c, stmt, s->v.TryFinally.finalbody);
+       VISIT_SEQ_WITH_CAST(c, stmt, s->v.TryFinally.finalbody, stmt_ty);

+#define VISIT_SEQ_WITH_CAST(C, TYPE, SEQ, CAST) { \
+       int _i; \
+       asdl_seq *seq = (SEQ); /* avoid variable capture */ \
+       for (_i = 0; _i < asdl_seq_LEN(seq); _i++) { \
+               TYPE ## _ty elt = (CAST)asdl_seq_GET(seq, _i); \

                                            (##_ty) instead of CAST?

+               if (!compiler_visit_ ## TYPE((C), elt)) \
+                       return 0; \
+       } \
+}
+

Jeremy


More information about the Python-checkins mailing list