]> granicus.if.org Git - python/commitdiff
replace PyXXX_Length calls with PyXXX_Size calls
authorJeremy Hylton <jeremy@alum.mit.edu>
Wed, 12 Jul 2000 13:05:33 +0000 (13:05 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Wed, 12 Jul 2000 13:05:33 +0000 (13:05 +0000)
14 files changed:
Modules/_sre.c
Modules/_tkinter.c
Modules/almodule.c
Modules/cPickle.c
Modules/cStringIO.c
Modules/parsermodule.c
Modules/posixmodule.c
Modules/stropmodule.c
Objects/listobject.c
Objects/stringobject.c
Objects/unicodeobject.c
Python/bltinmodule.c
Python/exceptions.c
Python/getargs.c

index 2ab1703636cdde2f3180ad403cd3ec9842476fc1..5beb3ea024edced10d536d86e00d22b201920276 100644 (file)
@@ -1127,7 +1127,7 @@ _compile(PyObject* self_, PyObject* args)
        if (!code)
                return NULL;
 
-    n = PySequence_Length(code);
+    n = PySequence_Size(code);
 
        self = PyObject_NEW_VAR(PatternObject, &Pattern_Type, 100*n);
        if (!self) {
index 6be3e048e06a5fdf7813a2c1e4213422ec31ba1d..8fb321ee7750fcb4b7fb05edff51ab4c209473e8 100644 (file)
@@ -1934,7 +1934,7 @@ Tkinter_Flatten(PyObject* self, PyObject* args)
        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);
        
index d9dfc81c26550845bb79475122c0860491dd719c..84a989541c3bc8a9373a3b969ad5597283f8781e 100644 (file)
@@ -176,13 +176,13 @@ python2param(int resource, ALpv *param, PyObject *value, ALparamInfo *pinfo)
                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;
index f9ef78f980f34ea6faef72b9a88dafe0392c07eb..52b3a1fe0f55c2ffd3cc00d52b03e5aa6f6489f2 100644 (file)
@@ -1466,7 +1466,7 @@ save_inst(Picklerobject *self, PyObject *args) {
             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++) {
@@ -2874,7 +2874,7 @@ Instance_New(PyObject *cls, PyObject *args) {
   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__;
 
index 4c187fe996bc3cc898ae80ac8bb5a250828df72d..321e79bd386b86bd7834e24c98e80c04795b0361 100644 (file)
@@ -367,7 +367,7 @@ O_writelines(Oobject *self, PyObject *args) {
     Py_DECREF(string_module);
   }
 
-  if (PyObject_Length(args) == -1) {
+  if (PyObject_Size(args) == -1) {
     return NULL;
   }
 
index feea8daf58ba4a07332f0c9c4f4f20def4b13cd5..27203c3ca50b34d51516d225e65f8a2096a0b431 100644 (file)
@@ -610,7 +610,7 @@ parser_tuple2ast(PyAST_Object *self, PyObject *args, PyObject *kw)
      *  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);
@@ -626,7 +626,7 @@ parser_tuple2ast(PyAST_Object *self, PyObject *args, PyObject *kw)
     }
     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) {
@@ -693,7 +693,7 @@ parser_tuple2ast(PyAST_Object *self, PyObject *args, PyObject *kw)
 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.";
 
@@ -731,7 +731,7 @@ check_terminal_tuple(PyObject *elem)
 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) {
@@ -771,7 +771,7 @@ build_node_children(PyObject *tuple, node *root, int *line_num)
                     (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);
index c0b30f9514b511346ff930ed23f8af1c4fd349f7..d87983710ac6d09ee0db7e5dd8a4658ab7d3a1bc 100644 (file)
@@ -1417,7 +1417,7 @@ posix_execve(PyObject *self, PyObject *args)
        }
        argvlist[argc] = NULL;
 
-       i = PyMapping_Length(env);
+       i = PyMapping_Size(env);
        envlist = PyMem_NEW(char *, i + 1);
        if (envlist == NULL) {
                PyErr_NoMemory();
@@ -1610,7 +1610,7 @@ posix_spawnve(PyObject *self, PyObject *args)
        }
        argvlist[argc] = NULL;
 
-       i = PyMapping_Length(env);
+       i = PyMapping_Size(env);
        envlist = PyMem_NEW(char *, i + 1);
        if (envlist == NULL) {
                PyErr_NoMemory();
index 35674de85b89d83715ab77248b1dd244186558f0..612d0d3908ee7887da5f40627c0b449b2b13570d 100644 (file)
@@ -190,7 +190,7 @@ strop_joinfields(PyObject *self, PyObject *args)
                seplen = 1;
        }
 
-       seqlen = PySequence_Length(seq);
+       seqlen = PySequence_Size(seq);
        if (seqlen < 0 && PyErr_Occurred())
                return NULL;
 
index 9c49dad9d727cb738b0e272ea540128ac1fc227d..e85e2f49bf2f688b6a994e40b5b84164731ca37f 100644 (file)
@@ -563,7 +563,7 @@ listextend(PyListObject *self, PyObject *args)
        if (!b)
                return NULL;
 
-       if (PyObject_Length(b) == 0)
+       if (PyObject_Size(b) == 0)
                /* short circuit when b is empty */
                goto ok;
 
@@ -585,7 +585,7 @@ listextend(PyListObject *self, PyObject *args)
                }
        }
 
-       blen = PyObject_Length(b);
+       blen = PyObject_Size(b);
 
        /* resize a using idiom */
        items = self->ob_item;
index f4b90e86372f403f4bdd69df79f2c5505ed23893..ab44e91f2df0968df406b785e855dcedf91b6e8f 100644 (file)
@@ -759,7 +759,7 @@ string_join(PyStringObject *self, PyObject *args)
        /* 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);
index f10b8002a812c867340d757f64c084fcb37d855d..02d1b0d5d8ab535dbbe3609c614a2253d825189e 100644 (file)
@@ -2650,7 +2650,7 @@ PyObject *PyUnicode_Join(PyObject *separator,
     int sz = 100;
     int i;
 
-    seqlen = PySequence_Length(seq);
+    seqlen = PySequence_Size(seq);
     if (seqlen < 0 && PyErr_Occurred())
        return NULL;
 
index a00cd5dbf8d4a47ec62c363be8f5f885010b59e0..07462822f3371b113b793d17af43f91c85164743 100644 (file)
@@ -1385,7 +1385,7 @@ builtin_len(self, args)
 
        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);
index c0e4d5464bc86879902d132bd6efa531a5f7954b..05e318e453815b8f30c81a9b5ef6ca751f52c5bb 100644 (file)
@@ -224,7 +224,8 @@ Exception__init__(PyObject* self, PyObject* args)
        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);
@@ -249,7 +250,7 @@ Exception__str__(PyObject* self, PyObject* args)
     if (!args)
         return NULL;
 
-    switch (PySequence_Length(args)) {
+    switch (PySequence_Size(args)) {
     case 0:
         out = PyString_FromString("");
         break;
@@ -374,7 +375,7 @@ SystemExit__init__(PyObject* self, PyObject* args)
        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);
@@ -384,7 +385,7 @@ SystemExit__init__(PyObject* self, PyObject* args)
     }
 
     /* set code attribute */
-    switch (PySequence_Length(args)) {
+    switch (PySequence_Size(args)) {
     case 0:
         Py_INCREF(Py_None);
         code = Py_None;
@@ -441,7 +442,7 @@ EnvironmentError__init__(PyObject* self, PyObject* args)
     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) ||
@@ -452,7 +453,7 @@ EnvironmentError__init__(PyObject* self, PyObject* 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
@@ -671,13 +672,13 @@ SyntaxError__init__(PyObject* self, PyObject* args)
     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;
index ba855afb1966710c2a514f1fbe9a23429fdf3d2a..11754ef26f96277bc64668262d2dc21f0064ba1d 100644 (file)
@@ -348,7 +348,7 @@ converttuple(arg, p_format, p_va, levels, msgbuf, toplevel)
                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",