diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2006-04-11 08:06:50 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2006-04-11 08:06:50 (GMT) |
commit | 01b810106c348db2e3242126adf655b686aa2a1c (patch) | |
tree | 05720ebb7aced194421b69bb1ea225af60ac0092 /Parser | |
parent | 9b26122ec0f0b2dd219070b19efd95f54aade034 (diff) | |
download | cpython-01b810106c348db2e3242126adf655b686aa2a1c.zip cpython-01b810106c348db2e3242126adf655b686aa2a1c.tar.gz cpython-01b810106c348db2e3242126adf655b686aa2a1c.tar.bz2 |
Make _kind types global for C++ compilation.
Explicitly cast void* to int to cmpop_ty.
Diffstat (limited to 'Parser')
-rwxr-xr-x | Parser/asdl_c.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index fdbbeaf..0639789 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -155,8 +155,10 @@ class StructVisitor(EmitVisitor): type = sum.types[i] enum.append("%s_kind=%d" % (type.name, i + 1)) + emit("enum _%(name)s_kind {" + ", ".join(enum) + "};") + emit("struct _%(name)s {") - emit("enum { " + ", ".join(enum) + " } kind;", depth + 1) + emit("enum _%(name)s_kind kind;", depth + 1) emit("union {", depth + 1) for t in sum.types: self.visit(t, depth + 2) @@ -679,8 +681,8 @@ class ObjVisitor(PickleVisitor): self.emit("if (!value) goto failed;", depth+1) self.emit("for(i = 0; i < n; i++)", depth+1) # This cannot fail, so no need for error handling - self.emit("PyList_SET_ITEM(value, i, ast2obj_%s((%s_ty)asdl_seq_GET(%s, i)));" % - (field.type, field.type, value), depth+2, reflow=False) + self.emit("PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)(int)asdl_seq_GET(%s, i)));" % value, + depth+2, reflow=False) self.emit("}", depth) else: self.emit("value = ast2obj_list(%s, ast2obj_%s);" % (value, field.type), depth) |