Merge ssize_t branch.

This commit is contained in:
Martin v. Löwis 2006-02-15 17:27:45 +00:00
parent 4482929734
commit 18e165558b
102 changed files with 2659 additions and 1677 deletions

View file

@ -232,7 +232,7 @@ static int
func_set_code(PyFunctionObject *op, PyObject *value)
{
PyObject *tmp;
int nfree, nclosure;
Py_ssize_t nfree, nclosure;
if (restricted())
return -1;
@ -248,8 +248,8 @@ func_set_code(PyFunctionObject *op, PyObject *value)
PyTuple_GET_SIZE(op->func_closure));
if (nclosure != nfree) {
PyErr_Format(PyExc_ValueError,
"%s() requires a code object with %d free vars,"
" not %d",
"%s() requires a code object with %ld free vars,"
" not %ld",
PyString_AsString(op->func_name),
nclosure, nfree);
return -1;
@ -363,7 +363,7 @@ func_new(PyTypeObject* type, PyObject* args, PyObject* kw)
PyObject *defaults = Py_None;
PyObject *closure = Py_None;
PyFunctionObject *newfunc;
int nfree, nclosure;
Py_ssize_t nfree, nclosure;
static const char *kwlist[] = {"code", "globals", "name",
"argdefs", "closure", 0};
@ -401,11 +401,11 @@ func_new(PyTypeObject* type, PyObject* args, PyObject* kw)
nclosure = closure == Py_None ? 0 : PyTuple_GET_SIZE(closure);
if (nfree != nclosure)
return PyErr_Format(PyExc_ValueError,
"%s requires closure of length %d, not %d",
"%s requires closure of length %ld, not %ld",
PyString_AS_STRING(code->co_name),
nfree, nclosure);
if (nclosure) {
int i;
Py_ssize_t i;
for (i = 0; i < nclosure; i++) {
PyObject *o = PyTuple_GET_ITEM(closure, i);
if (!PyCell_Check(o)) {
@ -516,7 +516,7 @@ function_call(PyObject *func, PyObject *arg, PyObject *kw)
PyObject *result;
PyObject *argdefs;
PyObject **d, **k;
int nk, nd;
Py_ssize_t nk, nd;
argdefs = PyFunction_GET_DEFAULTS(func);
if (argdefs != NULL && PyTuple_Check(argdefs)) {
@ -529,7 +529,7 @@ function_call(PyObject *func, PyObject *arg, PyObject *kw)
}
if (kw != NULL && PyDict_Check(kw)) {
int pos, i;
Py_ssize_t pos, i;
nk = PyDict_Size(kw);
k = PyMem_NEW(PyObject *, 2*nk);
if (k == NULL) {