Skip to content

Commit

Permalink
maintain support for older python versions in this module so that it
Browse files Browse the repository at this point in the history
is ok for a standalone pybsddb source dist for use with <= 2.3.
  • Loading branch information
gpshead committed Jan 30, 2006
1 parent c26cf5a commit fd049a6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Modules/_bsddb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit fd049a6

Please sign in to comment.