~pythonregexp2.7/python/issue2636

« back to all changes in this revision

Viewing changes to Objects/listobject.c

  • Committer: Jeffrey C. "The TimeHorse" Jacobs
  • Date: 2008-06-09 14:36:32 UTC
  • mfrom: (39021.1.402 Regexp-2.6)
  • Revision ID: darklord@timehorse.com-20080609143632-wwwkx92u1t5l7yd3
Merged in changes from the latest python source snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2420
2420
        return 0;
2421
2421
}
2422
2422
 
 
2423
static PyObject *
 
2424
list_sizeof(PyListObject *self)
 
2425
{
 
2426
        Py_ssize_t res;
 
2427
 
 
2428
        res = sizeof(PyListObject) + self->allocated * sizeof(void*);
 
2429
        return PyInt_FromSsize_t(res);
 
2430
}
 
2431
 
2423
2432
static PyObject *list_iter(PyObject *seq);
2424
2433
static PyObject *list_reversed(PyListObject* seq, PyObject* unused);
2425
2434
 
2427
2436
"x.__getitem__(y) <==> x[y]");
2428
2437
PyDoc_STRVAR(reversed_doc,
2429
2438
"L.__reversed__() -- return a reverse iterator over the list");
 
2439
PyDoc_STRVAR(sizeof_doc,
 
2440
"L.__sizeof__() -- size of L in memory, in bytes");
2430
2441
PyDoc_STRVAR(append_doc,
2431
2442
"L.append(object) -- append object to end");
2432
2443
PyDoc_STRVAR(extend_doc,
2452
2463
static PyMethodDef list_methods[] = {
2453
2464
        {"__getitem__", (PyCFunction)list_subscript, METH_O|METH_COEXIST, getitem_doc},
2454
2465
        {"__reversed__",(PyCFunction)list_reversed, METH_NOARGS, reversed_doc},
 
2466
        {"__sizeof__",  (PyCFunction)list_sizeof, METH_NOARGS, sizeof_doc},
2455
2467
        {"append",      (PyCFunction)listappend,  METH_O, append_doc},
2456
2468
        {"insert",      (PyCFunction)listinsert,  METH_VARARGS, insert_doc},
2457
2469
        {"extend",      (PyCFunction)listextend,  METH_O, extend_doc},