summaryrefslogtreecommitdiffstats
path: root/Parser/asdl_c.py
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-02-26 18:10:47 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-02-26 18:10:47 (GMT)
commit7b7d1c8282fa2599e2f132c401defde3c9b42e3f (patch)
treeb3b1755eb9bc44d73eac17fd8b23451ba578d245 /Parser/asdl_c.py
parent1177bc4dfd74cc2671ccec26fd52d281c618e974 (diff)
downloadcpython-7b7d1c8282fa2599e2f132c401defde3c9b42e3f.zip
cpython-7b7d1c8282fa2599e2f132c401defde3c9b42e3f.tar.gz
cpython-7b7d1c8282fa2599e2f132c401defde3c9b42e3f.tar.bz2
Fix a couple of problems in generating the AST code:
* use %r instead of backticks since backticks are going away in Py3k * PyArena_Malloc() already sets PyErr_NoMemory so we don't need to do it again * the signature for ast2obj_int incorrectly used a bool, rather than a long
Diffstat (limited to 'Parser/asdl_c.py')
-rwxr-xr-xParser/asdl_c.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 14859ee..4877853 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -47,7 +47,7 @@ def reflow_lines(s, depth):
# XXX this should be fixed for real
if i == -1 and 'GeneratorExp' in cur:
i = size + 3
- assert i != -1, "Impossible line %d to reflow: %s" % (size, `s`)
+ assert i != -1, "Impossible line %d to reflow: %r" % (size, s)
lines.append(padding + cur[:i])
if len(lines) == 1:
# find new size based on brace
@@ -299,10 +299,8 @@ class FunctionVisitor(PrototypeVisitor):
emit('}', 1)
emit("p = (%s)PyArena_Malloc(arena, sizeof(*p));" % ctype, 1);
- emit("if (!p) {", 1)
- emit("PyErr_NoMemory();", 2)
+ emit("if (!p)", 1)
emit("return NULL;", 2)
- emit("}", 1)
if union:
self.emit_body_union(name, args, attrs)
else:
@@ -474,7 +472,7 @@ static PyObject* ast2obj_bool(bool b)
return PyBool_FromLong(b);
}
-static PyObject* ast2obj_int(bool b)
+static PyObject* ast2obj_int(long b)
{
return PyInt_FromLong(b);
}