]> granicus.if.org Git - python/commitdiff
maintain support for older python versions in this module so that it
authorGregory P. Smith <greg@mad-scientist.com>
Mon, 30 Jan 2006 00:22:08 +0000 (00:22 +0000)
committerGregory P. Smith <greg@mad-scientist.com>
Mon, 30 Jan 2006 00:22:08 +0000 (00:22 +0000)
is ok for a standalone pybsddb source dist for use with <= 2.3.

Modules/_bsddb.c

index f7541274b6b521995cf65e14ee41cd06a8b727cc..fca203dc32131edc45a22d6d1b577791e4a30e5e 100644 (file)
@@ -1537,11 +1537,19 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs)
                 keyObj = PyInt_FromLong(*(int *)key.data);
             else
                 keyObj = PyString_FromStringAndSize(key.data, key.size);
+#if (PY_VERSION_HEX >= 0x02040000)
             retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj);
+#else
+            retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj);
+#endif
         }
         else /* return just the pkey and data */
         {
+#if (PY_VERSION_HEX >= 0x02040000)
             retval = PyTuple_Pack(2, pkeyObj, dataObj);
+#else
+            retval = Py_BuildValue("OO", pkeyObj, dataObj);
+#endif
         }
        FREE_DBT(pkey);
         FREE_DBT(data);
@@ -3187,12 +3195,20 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
                 keyObj = PyInt_FromLong(*(int *)key.data);
             else
                 keyObj = PyString_FromStringAndSize(key.data, key.size);
+#if (PY_VERSION_HEX >= 0x02040000)
             retval = PyTuple_Pack(3, keyObj, pkeyObj, dataObj);
+#else
+            retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj);
+#endif
             FREE_DBT(key);
         }
         else /* return just the pkey and data */
         {
+#if (PY_VERSION_HEX >= 0x02040000)
             retval = PyTuple_Pack(2, pkeyObj, dataObj);
+#else
+            retval = Py_BuildValue("OO", pkeyObj, dataObj);
+#endif
         }
         FREE_DBT(pkey);
         FREE_DBT(data);