summaryrefslogtreecommitdiffstats
path: root/Parser/asdl_c.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2006-04-13 12:29:43 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2006-04-13 12:29:43 (GMT)
commit0cc56e5c59bbc9d839d1468f8b51ea9391e8852a (patch)
treeb01b94983a324fdc0e660fdd194a9f67060a6e6a /Parser/asdl_c.py
parent0f1955daeea82b6d8765d2b7642a9f082faddc74 (diff)
downloadcpython-0cc56e5c59bbc9d839d1468f8b51ea9391e8852a.zip
cpython-0cc56e5c59bbc9d839d1468f8b51ea9391e8852a.tar.gz
cpython-0cc56e5c59bbc9d839d1468f8b51ea9391e8852a.tar.bz2
Introduce asdl_int_seq, to hold cmpop_ty.
Diffstat (limited to 'Parser/asdl_c.py')
-rwxr-xr-xParser/asdl_c.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 0639789..6a8d981 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -188,7 +188,10 @@ class StructVisitor(EmitVisitor):
ctype = get_c_type(field.type)
name = field.name
if field.seq:
- self.emit("asdl_seq *%(name)s;" % locals(), depth)
+ if field.type.value in ('cmpop',):
+ self.emit("asdl_int_seq *%(name)s;" % locals(), depth)
+ else:
+ self.emit("asdl_seq *%(name)s;" % locals(), depth)
else:
self.emit("%(ctype)s %(name)s;" % locals(), depth)
@@ -234,7 +237,10 @@ class PrototypeVisitor(EmitVisitor):
name = f.name
# XXX should extend get_c_type() to handle this
if f.seq:
- ctype = "asdl_seq *"
+ if f.type.value in ('cmpop',):
+ ctype = "asdl_int_seq *"
+ else:
+ ctype = "asdl_seq *"
else:
ctype = get_c_type(f.type)
args.append((ctype, name, f.opt or f.seq))
@@ -681,7 +687,7 @@ 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_cmpop((cmpop_ty)(int)asdl_seq_GET(%s, i)));" % value,
+ self.emit("PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(%s, i)));" % value,
depth+2, reflow=False)
self.emit("}", depth)
else: