Index: asdl_c.py =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/Attic/asdl_c.py,v retrieving revision 1.1.2.3 diff -u -r1.1.2.3 asdl_c.py --- asdl_c.py 13 Apr 2004 14:54:43 -0000 1.1.2.3 +++ asdl_c.py 14 Jan 2005 23:33:58 -0000 @@ -407,7 +407,11 @@ emit("seq = %s;" % value, 0) emit("n = asdl_seq_LEN(seq);", 0) emit("for (i = 0; i < n; i++)", 0) - self.free(field, "asdl_seq_GET(seq, i)", depth + 1) + #hack for compilable code + if str(name) == "Global": + self.free(field, "(identifier)asdl_seq_GET(seq, i)", depth + 1) + else: + self.free(field, "asdl_seq_GET(seq, i)", depth + 1) # XXX need to know the simple types in advance, so that we # don't call free_TYPE() for them. @@ -419,13 +423,17 @@ self.free(field, value, depth) def free(self, field, value, depth): - if str(field.type) in ("identifier", "string"): + if str(field.type) in ("identifier", "string", "object"): self.emit("Py_DECREF(%s);" % value, depth) elif str(field.type) == "bool": return else: print >> sys.stderr, field.type - self.emit("free_%s(%s);" % (field.type, value), depth) + #hack to produce compilable code + if str(field.type) == 'cmpop': + self.emit("free_%s((cmpop_ty)%s);" % (field.type, value), depth) + else: + self.emit("free_%s(%s);" % (field.type, value), depth) class MarshalFunctionVisitor(PickleVisitor): @@ -487,7 +495,12 @@ emit("marshal_write_int(buf, off, asdl_seq_LEN(%s));" % value, 0) emit("for (i = 0; i < asdl_seq_LEN(%s); i++) {" % value, 0) emit("void *elt = asdl_seq_GET(%s, i);" % value, 1); - emit("marshal_write_%s(buf, off, elt);" % field.type, 1) + if str(field.type) == "cmpop": + # hack so generated code will compile + emit("marshal_write_%s(buf, off, (%s_ty) elt);" % (field.type, + field.type), 1) + else: + emit("marshal_write_%s(buf, off, elt);" % field.type, 1) emit("}", 0) elif field.opt: emit("if (%s) {" % value, 0)