Commit 7b7d1c82 authored by Neal Norwitz's avatar Neal Norwitz

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
parent 1177bc4d
......@@ -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);
}
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment