if (!code)
return NULL;
- n = PySequence_Length(code);
+ n = PySequence_Size(code);
self = PyObject_NEW_VAR(PatternObject, &Pattern_Type, 100*n);
if (!self) {
if (!PyArg_ParseTuple(args, "O:_flatten", &item))
return NULL;
- context.maxsize = PySequence_Length(item);
+ context.maxsize = PySequence_Size(item);
if (context.maxsize <= 0)
return PyTuple_New(0);
case AL_INT32_ELEM:
case AL_RESOURCE_ELEM:
case AL_ENUM_ELEM:
- param->sizeIn = PySequence_Length(value);
+ param->sizeIn = PySequence_Size(value);
param->value.ptr = PyMem_NEW(int, param->sizeIn);
stepsize = sizeof(int);
break;
case AL_INT64_ELEM:
case AL_FIXED_ELEM:
- param->sizeIn = PySequence_Length(value);
+ param->sizeIn = PySequence_Size(value);
param->value.ptr = PyMem_NEW(long long, param->sizeIn);
stepsize = sizeof(long long);
break;
PyObject_CallObject(getinitargs_func, empty_tuple))
goto finally;
- if ((len = PyObject_Length(class_args)) < 0)
+ if ((len = PyObject_Size(class_args)) < 0)
goto finally;
for (i = 0; i < len; i++) {
if (PyClass_Check(cls)) {
int l;
- if ((l=PyObject_Length(args)) < 0) goto err;
+ if ((l=PyObject_Size(args)) < 0) goto err;
UNLESS (l) {
PyObject *__getinitargs__;
Py_DECREF(string_module);
}
- if (PyObject_Length(args) == -1) {
+ if (PyObject_Size(args) == -1) {
return NULL;
}
* so we can DECREF it after the check. But we really should accept
* lists as well as tuples at the very least.
*/
- ok = PyObject_Length(tuple) >= 2;
+ ok = PyObject_Size(tuple) >= 2;
if (ok) {
temp = PySequence_GetItem(tuple, 0);
ok = (temp != NULL) && PyInt_Check(temp);
}
if (ok) {
temp = PySequence_GetItem(tuple, 1);
- ok = (temp != NULL) && PyObject_Length(temp) >= 2;
+ ok = (temp != NULL) && PyObject_Size(temp) >= 2;
if (ok) {
PyObject *temp2 = PySequence_GetItem(temp, 0);
if (temp2 != NULL) {
static int
check_terminal_tuple(PyObject *elem)
{
- int len = PyObject_Length(elem);
+ int len = PyObject_Size(elem);
int res = 1;
char* str = "Illegal terminal symbol; bad node length.";
static node*
build_node_children(PyObject *tuple, node *root, int *line_num)
{
- int len = PyObject_Length(tuple);
+ int len = PyObject_Size(tuple);
int i;
for (i = 1; i < len; ++i) {
(void) strcpy(strn, PyString_AS_STRING(temp));
Py_DECREF(temp);
- if (PyObject_Length(elem) == 3) {
+ if (PyObject_Size(elem) == 3) {
PyObject* temp = PySequence_GetItem(elem, 2);
*line_num = PyInt_AsLong(temp);
Py_DECREF(temp);
}
argvlist[argc] = NULL;
- i = PyMapping_Length(env);
+ i = PyMapping_Size(env);
envlist = PyMem_NEW(char *, i + 1);
if (envlist == NULL) {
PyErr_NoMemory();
}
argvlist[argc] = NULL;
- i = PyMapping_Length(env);
+ i = PyMapping_Size(env);
envlist = PyMem_NEW(char *, i + 1);
if (envlist == NULL) {
PyErr_NoMemory();
seplen = 1;
}
- seqlen = PySequence_Length(seq);
+ seqlen = PySequence_Size(seq);
if (seqlen < 0 && PyErr_Occurred())
return NULL;
if (!b)
return NULL;
- if (PyObject_Length(b) == 0)
+ if (PyObject_Size(b) == 0)
/* short circuit when b is empty */
goto ok;
}
}
- blen = PyObject_Length(b);
+ blen = PyObject_Size(b);
/* resize a using idiom */
items = self->ob_item;
/* From here on out, errors go through finally: for proper
* reference count manipulations.
*/
- seqlen = PySequence_Length(seq);
+ seqlen = PySequence_Size(seq);
if (seqlen == 1) {
item = PySequence_Fast_GET_ITEM(seq, 0);
Py_INCREF(item);
int sz = 100;
int i;
- seqlen = PySequence_Length(seq);
+ seqlen = PySequence_Size(seq);
if (seqlen < 0 && PyErr_Occurred())
return NULL;
if (!PyArg_ParseTuple(args, "O:len", &v))
return NULL;
- res = PyObject_Length(v);
+ res = PyObject_Size(v);
if (res < 0 && PyErr_Occurred())
return NULL;
return PyInt_FromLong(res);
return NULL;
/* set args attribute */
- args = PySequence_GetSlice(args, 1, PySequence_Length(args));
+ /* XXX size is only a hint */
+ args = PySequence_GetSlice(args, 1, PySequence_Size(args));
if (!args)
return NULL;
status = PyObject_SetAttrString(self, "args", args);
if (!args)
return NULL;
- switch (PySequence_Length(args)) {
+ switch (PySequence_Size(args)) {
case 0:
out = PyString_FromString("");
break;
return NULL;
/* Set args attribute. */
- if (!(args = PySequence_GetSlice(args, 1, PySequence_Length(args))))
+ if (!(args = PySequence_GetSlice(args, 1, PySequence_Size(args))))
return NULL;
status = PyObject_SetAttrString(self, "args", args);
}
/* set code attribute */
- switch (PySequence_Length(args)) {
+ switch (PySequence_Size(args)) {
case 0:
Py_INCREF(Py_None);
code = Py_None;
if (!(self = get_self(args)))
return NULL;
- if (!(args = PySequence_GetSlice(args, 1, PySequence_Length(args))))
+ if (!(args = PySequence_GetSlice(args, 1, PySequence_Size(args))))
return NULL;
if (PyObject_SetAttrString(self, "args", args) ||
goto finally;
}
- switch (PySequence_Length(args)) {
+ switch (PySequence_Size(args)) {
case 3:
/* Where a function has a single filename, such as open() or some
* of the os module functions, PyErr_SetFromErrnoWithFilename() is
if (!(self = get_self(args)))
return NULL;
- if (!(args = PySequence_GetSlice(args, 1, PySequence_Length(args))))
+ if (!(args = PySequence_GetSlice(args, 1, PySequence_Size(args))))
return NULL;
if (PyObject_SetAttrString(self, "args", args))
goto finally;
- lenargs = PySequence_Length(args);
+ lenargs = PySequence_Size(args);
if (lenargs >= 1) {
PyObject* item0 = PySequence_GetItem(args, 0);
int status;
return msgbuf;
}
- if ((i = PySequence_Length(arg)) != n) {
+ if ((i = PySequence_Size(arg)) != n) {
levels[0] = 0;
sprintf(msgbuf,
toplevel ? "%d arguments, %d" : "%d-sequence, %d-sequence",