]> granicus.if.org Git - python/commitdiff
Fix errors on 64-bit platforms. Will backport
authorNeal Norwitz <nnorwitz@gmail.com>
Thu, 5 Jan 2006 05:43:35 +0000 (05:43 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Thu, 5 Jan 2006 05:43:35 +0000 (05:43 +0000)
Misc/NEWS
Modules/_bsddb.c

index a0d04e2a574e1fbc0d6c09172090b3439cb5a924..37b127a37e2f00dc8d6cae9498fc607b7cd3ad70 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -209,6 +209,8 @@ Core and builtins
 Extension Modules
 -----------------
 
+- Fix 64-bit problems in bsddb.
+
 - Patch #1365916: fix some unsafe 64-bit mmap methods.
 
 - Bug #1290333: Added a workaround for cjkcodecs' _codecs_cn build
index 59931c3ceff0bb1eb6af92e12d21a3dd402c420f..6f4da7ee61615ebd9dc070a8cb1a31f731fb3278 100644 (file)
@@ -1522,7 +1522,7 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs)
 
         if (self->primaryDBType == DB_RECNO ||
             self->primaryDBType == DB_QUEUE)
-            pkeyObj = PyInt_FromLong(*(long *)pkey.data);
+            pkeyObj = PyInt_FromLong(*(int *)pkey.data);
         else
             pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size);
 
@@ -1531,7 +1531,7 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs)
             PyObject *keyObj;
             int type = _DB_get_type(self);
             if (type == DB_RECNO || type == DB_QUEUE)
-                keyObj = PyInt_FromLong(*(long *)key.data);
+                keyObj = PyInt_FromLong(*(int *)key.data);
             else
                 keyObj = PyString_FromStringAndSize(key.data, key.size);
             retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj);
@@ -3172,7 +3172,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
 
         if (self->mydb->primaryDBType == DB_RECNO ||
             self->mydb->primaryDBType == DB_QUEUE)
-            pkeyObj = PyInt_FromLong(*(long *)pkey.data);
+            pkeyObj = PyInt_FromLong(*(int *)pkey.data);
         else
             pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size);
 
@@ -3181,7 +3181,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
             PyObject *keyObj;
             int type = _DB_get_type(self->mydb);
             if (type == DB_RECNO || type == DB_QUEUE)
-                keyObj = PyInt_FromLong(*(long *)key.data);
+                keyObj = PyInt_FromLong(*(int *)key.data);
             else
                 keyObj = PyString_FromStringAndSize(key.data, key.size);
             retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj);