]> granicus.if.org Git - python/commitdiff
Restore PyXXX_Length() APIs for binary compatibility.
authorMarc-André Lemburg <mal@egenix.com>
Mon, 17 Jul 2000 09:22:55 +0000 (09:22 +0000)
committerMarc-André Lemburg <mal@egenix.com>
Mon, 17 Jul 2000 09:22:55 +0000 (09:22 +0000)
New code will see the macros and therefore use the PyXXX_Size()
APIs instead.
By Thomas Wouters.

Include/abstract.h
Objects/abstract.c

index b765c4bf7fcaca80d340aabcd9977304bbdbea7a..7a6b7cff1dc7da08b87a0a03e320d5e4ad1eb901 100644 (file)
@@ -383,8 +383,6 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
 
      DL_IMPORT(int) PyObject_Size(PyObject *o);
 
-#define PyObject_Length PyObject_Size
-
        /*
          Return the size of object o.  If the object, o, provides
         both sequence and mapping protocols, the sequence size is
@@ -393,6 +391,12 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
 
        */
 
+       /* For DLL compatibility */
+#undef PyObject_Length
+     DL_IMPORT(int) PyObject_Length(PyObject *o);
+#define PyObject_Length PyObject_Size
+
+
      DL_IMPORT(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key);
 
        /*
@@ -685,13 +689,17 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
 
      DL_IMPORT(int) PySequence_Size(PyObject *o);
 
-#define PySequence_Length PySequence_Size
-
        /*
          Return the size of sequence object o, or -1 on failure.
 
        */
 
+       /* For DLL compatibility */
+#undef PySequence_Length
+     DL_IMPORT(int) PySequence_Length(PyObject *o);
+#define PySequence_Length PySequence_Size
+
+
      DL_IMPORT(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2);
 
        /*
@@ -839,14 +847,18 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
 
      DL_IMPORT(int) PyMapping_Size(PyObject *o);
 
-#define PyMapping_Length PyMapping_Size
-
        /*
          Returns the number of keys in object o on success, and -1 on
         failure.  For objects that do not provide sequence protocol,
         this is equivalent to the Python expression: len(o).
        */
 
+       /* For DLL compatibility */
+#undef PyMapping_Length
+     DL_IMPORT(int) PyMapping_Length(PyObject *o);
+#define PyMapping_Length PyMapping_Size
+
+
      /* implemented as a macro:
 
      int PyMapping_DelItemString(PyObject *o, char *key);
index 2c7c307626a0f0de55254197c8d2275923ff1e29..1d990194d5defae7d2536b35955379f531833b7d 100644 (file)
@@ -78,6 +78,14 @@ PyObject_Size(PyObject *o)
        return PyMapping_Size(o);
 }
 
+#undef PyObject_Length
+int
+PyObject_Length(PyObject *o)
+{
+       return PyObject_Size(o);
+}
+#define PyObject_Length PyObject_Size
+
 PyObject *
 PyObject_GetItem(PyObject *o, PyObject *key)
 {
@@ -820,6 +828,14 @@ PySequence_Size(PyObject *s)
        return -1;
 }
 
+#undef PySequence_Length
+int
+PySequence_Length(PyObject *s)
+{
+       return PySequence_Size(s);
+}
+#define PySequence_Length PySequence_Size
+
 PyObject *
 PySequence_Concat(PyObject *s, PyObject *o)
 {
@@ -1278,6 +1294,14 @@ PyMapping_Size(PyObject *o)
        return -1;
 }
 
+#undef PyMapping_Length
+int
+PyMapping_Length(PyObject *o)
+{
+       return PyMapping_Size(o);
+}
+#define PyMapping_Length PyMapping_Size
+
 PyObject *
 PyMapping_GetItemString(PyObject *o, char *key)
 {