Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40c6b47

Browse files
committed
Fix errors on 64-bit platforms. Will backport
1 parent 5f86142 commit 40c6b47

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,8 @@ Core and builtins
209209
Extension Modules
210210
-----------------
211211

212+
- Fix 64-bit problems in bsddb.
213+
212214
- Patch #1365916: fix some unsafe 64-bit mmap methods.
213215

214216
- Bug #1290333: Added a workaround for cjkcodecs' _codecs_cn build

Modules/_bsddb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,7 +1522,7 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs)
15221522

15231523
if (self->primaryDBType == DB_RECNO ||
15241524
self->primaryDBType == DB_QUEUE)
1525-
pkeyObj = PyInt_FromLong(*(long *)pkey.data);
1525+
pkeyObj = PyInt_FromLong(*(int *)pkey.data);
15261526
else
15271527
pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size);
15281528

@@ -1531,7 +1531,7 @@ DB_pget(DBObject* self, PyObject* args, PyObject* kwargs)
15311531
PyObject *keyObj;
15321532
int type = _DB_get_type(self);
15331533
if (type == DB_RECNO || type == DB_QUEUE)
1534-
keyObj = PyInt_FromLong(*(long *)key.data);
1534+
keyObj = PyInt_FromLong(*(int *)key.data);
15351535
else
15361536
keyObj = PyString_FromStringAndSize(key.data, key.size);
15371537
retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj);
@@ -3172,7 +3172,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
31723172

31733173
if (self->mydb->primaryDBType == DB_RECNO ||
31743174
self->mydb->primaryDBType == DB_QUEUE)
3175-
pkeyObj = PyInt_FromLong(*(long *)pkey.data);
3175+
pkeyObj = PyInt_FromLong(*(int *)pkey.data);
31763176
else
31773177
pkeyObj = PyString_FromStringAndSize(pkey.data, pkey.size);
31783178

@@ -3181,7 +3181,7 @@ DBC_pget(DBCursorObject* self, PyObject* args, PyObject *kwargs)
31813181
PyObject *keyObj;
31823182
int type = _DB_get_type(self->mydb);
31833183
if (type == DB_RECNO || type == DB_QUEUE)
3184-
keyObj = PyInt_FromLong(*(long *)key.data);
3184+
keyObj = PyInt_FromLong(*(int *)key.data);
31853185
else
31863186
keyObj = PyString_FromStringAndSize(key.data, key.size);
31873187
retval = Py_BuildValue("OOO", keyObj, pkeyObj, dataObj);

0 commit comments

Comments
 (0)