summaryrefslogtreecommitdiff
path: root/Parser/asdl_c.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2012-05-15 10:10:27 -0700
committerBenjamin Peterson <benjamin@python.org>2012-05-15 10:10:27 -0700
commit77fa9379e2fd9c074b4c002c0fd5d43caca80fff (patch)
tree31579855124ad12ff3fa985f081164966820b472 /Parser/asdl_c.py
parentc5f31ed63d7db6f7e13112790d15a6274ca7c2cf (diff)
downloadcpython-git-77fa9379e2fd9c074b4c002c0fd5d43caca80fff.tar.gz
use Py_ssize_t for ast sequence lengths
Diffstat (limited to 'Parser/asdl_c.py')
-rwxr-xr-xParser/asdl_c.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index 81a3d6af58..769f73f0cb 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -784,7 +784,7 @@ static int add_attributes(PyTypeObject* type, char**attrs, int num_fields)
static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))
{
- int i, n = asdl_seq_LEN(seq);
+ Py_ssize_t i, n = asdl_seq_LEN(seq);
PyObject *result = PyList_New(n);
PyObject *value;
if (!result)
@@ -1106,7 +1106,7 @@ class ObjVisitor(PickleVisitor):
# While the sequence elements are stored as void*,
# ast2obj_cmpop expects an enum
self.emit("{", depth)
- self.emit("int i, n = asdl_seq_LEN(%s);" % value, depth+1)
+ self.emit("Py_ssize_t i, n = asdl_seq_LEN(%s);" % value, depth+1)
self.emit("value = PyList_New(n);", depth+1)
self.emit("if (!value) goto failed;", depth+1)
self.emit("for(i = 0; i < n; i++)", depth+1)