summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Python/bltinmodule.c30
-rw-r--r--Python/errors.c2
-rw-r--r--Python/getargs.c4
-rw-r--r--Python/modsupport.c2
-rw-r--r--Python/symtable.c2
-rw-r--r--Python/sysmodule.c3
-rw-r--r--Python/traceback.c3
7 files changed, 24 insertions, 22 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 4f607d6..c92499d 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -193,8 +193,8 @@ static PyObject *
builtin_filter(PyObject *self, PyObject *args)
{
PyObject *func, *seq, *result, *it, *arg;
- int len; /* guess for result list size */
- register int j;
+ Py_ssize_t len; /* guess for result list size */
+ register Py_ssize_t j;
if (!PyArg_UnpackTuple(args, "filter", 2, 2, &func, &seq))
return NULL;
@@ -860,7 +860,7 @@ builtin_map(PyObject *self, PyObject *args)
len = 0;
for (i = 0, sqp = seqs; i < n; ++i, ++sqp) {
PyObject *curseq;
- int curlen;
+ Py_ssize_t curlen;
/* Get iterator. */
curseq = PyTuple_GetItem(args, i+1);
@@ -1338,7 +1338,7 @@ static PyObject *
builtin_ord(PyObject *self, PyObject* obj)
{
long ord;
- int size;
+ Py_ssize_t size;
if (PyString_Check(obj)) {
size = PyString_GET_SIZE(obj);
@@ -1363,7 +1363,7 @@ builtin_ord(PyObject *self, PyObject* obj)
PyErr_Format(PyExc_TypeError,
"ord() expected a character, "
- "but string of length %d found",
+ "but string of length %zd found",
size);
return NULL;
}
@@ -2094,10 +2094,10 @@ static PyObject*
builtin_zip(PyObject *self, PyObject *args)
{
PyObject *ret;
- const int itemsize = PySequence_Length(args);
- int i;
+ const Py_ssize_t itemsize = PySequence_Length(args);
+ Py_ssize_t i;
PyObject *itlist; /* tuple of iterators */
- int len; /* guess at result length */
+ Py_ssize_t len; /* guess at result length */
if (itemsize == 0)
return PyList_New(0);
@@ -2111,7 +2111,7 @@ builtin_zip(PyObject *self, PyObject *args)
len = -1; /* unknown */
for (i = 0; i < itemsize; ++i) {
PyObject *item = PyTuple_GET_ITEM(args, i);
- int thislen = _PyObject_LengthHint(item);
+ Py_ssize_t thislen = _PyObject_LengthHint(item);
if (thislen < 0) {
if (!PyErr_ExceptionMatches(PyExc_TypeError) &&
!PyErr_ExceptionMatches(PyExc_AttributeError)) {
@@ -2460,7 +2460,7 @@ filterstring(PyObject *func, PyObject *strobj)
Py_DECREF(good);
}
if (ok) {
- int reslen;
+ Py_ssize_t reslen;
if (!PyString_Check(item)) {
PyErr_SetString(PyExc_TypeError, "can't filter str to str:"
" __getitem__ returned different type");
@@ -2473,7 +2473,7 @@ filterstring(PyObject *func, PyObject *strobj)
PyString_AS_STRING(item)[0];
} else {
/* do we need more space? */
- int need = j + reslen + len-i-1;
+ Py_ssize_t need = j + reslen + len-i-1;
if (need > outlen) {
/* overallocate, to avoid reallocations */
if (need<2*outlen)
@@ -2513,8 +2513,8 @@ filterunicode(PyObject *func, PyObject *strobj)
{
PyObject *result;
register int i, j;
- int len = PyUnicode_GetSize(strobj);
- int outlen = len;
+ Py_ssize_t len = PyUnicode_GetSize(strobj);
+ Py_ssize_t outlen = len;
if (func == Py_None) {
/* If it's a real string we can return the original,
@@ -2554,7 +2554,7 @@ filterunicode(PyObject *func, PyObject *strobj)
Py_DECREF(good);
}
if (ok) {
- int reslen;
+ Py_ssize_t reslen;
if (!PyUnicode_Check(item)) {
PyErr_SetString(PyExc_TypeError,
"can't filter unicode to unicode:"
@@ -2568,7 +2568,7 @@ filterunicode(PyObject *func, PyObject *strobj)
PyUnicode_AS_UNICODE(item)[0];
else {
/* do we need more space? */
- int need = j + reslen + len - i - 1;
+ Py_ssize_t need = j + reslen + len - i - 1;
if (need > outlen) {
/* overallocate,
to avoid reallocations */
diff --git a/Python/errors.c b/Python/errors.c
index ce36fc1..ace63ff 100644
--- a/Python/errors.c
+++ b/Python/errors.c
@@ -83,7 +83,7 @@ PyErr_GivenExceptionMatches(PyObject *err, PyObject *exc)
return 0;
}
if (PyTuple_Check(exc)) {
- int i, n;
+ Py_ssize_t i, n;
n = PyTuple_Size(exc);
for (i = 0; i < n; i++) {
/* Test recursively */
diff --git a/Python/getargs.c b/Python/getargs.c
index 0615577..273cb43 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -153,7 +153,7 @@ cleanreturn(int retval, PyObject *freelist)
{
if(freelist) {
if((retval) == 0) {
- int len = PyList_GET_SIZE(freelist), i;
+ Py_ssize_t len = PyList_GET_SIZE(freelist), i;
for (i = 0; i < len; i++)
PyMem_FREE(PyCObject_AsVoidPtr(
PyList_GET_ITEM(freelist, i)));
@@ -176,7 +176,7 @@ vgetargs1(PyObject *args, const char *format, va_list *p_va, int flags)
int level = 0;
int endfmt = 0;
const char *formatsave = format;
- int i, len;
+ Py_ssize_t i, len;
char *msg;
PyObject *freelist = NULL;
int compat = flags & FLAG_COMPAT;
diff --git a/Python/modsupport.c b/Python/modsupport.c
index f92fc34..2356a9e 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -315,7 +315,7 @@ do_mkvalue(const char **p_format, va_list *p_va)
case 'n':
#if SIZEOF_SIZE_T!=SIZEOF_LONG
- return PyLong_FromSsize_t(va_arg(*p_va, Py_Ssize_t));
+ return PyInt_FromSsize_t(va_arg(*p_va, Py_ssize_t));
#endif
/* Fall through from 'n' to 'l' if Py_ssize_t is long */
case 'l':
diff --git a/Python/symtable.c b/Python/symtable.c
index 7f3f5db..fd95bd5 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -715,7 +715,7 @@ symtable_warn(struct symtable *st, char *msg, int lineno)
static int
symtable_exit_block(struct symtable *st, void *ast)
{
- int end;
+ Py_ssize_t end;
Py_DECREF(st->st_cur);
end = PyList_GET_SIZE(st->st_stack) - 1;
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index b240cc7..43c010b 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -947,7 +947,8 @@ static void
svnversion_init(void)
{
const char *python, *br_start, *br_end, *br_end2, *svnversion;
- int len, istag;
+ Py_ssize_t len;
+ int istag;
if (svn_initialized)
return;
diff --git a/Python/traceback.c b/Python/traceback.c
index b58e8ad..7b83d8b 100644
--- a/Python/traceback.c
+++ b/Python/traceback.c
@@ -153,7 +153,8 @@ tb_displayline(PyObject *f, char *filename, int lineno, char *name)
tail++;
path = PySys_GetObject("path");
if (path != NULL && PyList_Check(path)) {
- int npath = PyList_Size(path);
+ Py_ssize_t _npath = PyList_Size(path);
+ int npath = Py_SAFE_DOWNCAST(_npath, Py_ssize_t, int);
size_t taillen = strlen(tail);
char namebuf[MAXPATHLEN+1];
for (i = 0; i < npath; i++) {