[Python-checkins] cpython (2.7): Issue #17926: Fix dbm.__contains__ on 64-bit big-endian machines.

antoine.pitrou python-checkins at python.org
Wed May 8 01:51:46 CEST 2013


http://hg.python.org/cpython/rev/53da3bad8554
changeset:   83679:53da3bad8554
branch:      2.7
parent:      83667:8b764c3521fa
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed May 08 01:51:37 2013 +0200
summary:
  Issue #17926: Fix dbm.__contains__ on 64-bit big-endian machines.

files:
  Misc/NEWS           |  2 ++
  Modules/dbmmodule.c |  8 +++++---
  2 files changed, 7 insertions(+), 3 deletions(-)


diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -34,6 +34,8 @@
 Library
 -------
 
+- Issue #17926: Fix dbm.__contains__ on 64-bit big-endian machines.
+
 - Issue #17918: When using SSLSocket.accept(), if the SSL handshake failed
   on the new socket, the socket would linger indefinitely.  Thanks to
   Peter Saveliev for reporting.
diff --git a/Modules/dbmmodule.c b/Modules/dbmmodule.c
--- a/Modules/dbmmodule.c
+++ b/Modules/dbmmodule.c
@@ -168,11 +168,13 @@
 dbm_contains(register dbmobject *dp, PyObject *v)
 {
     datum key, val;
+    char *ptr;
+    Py_ssize_t size;
 
-    if (PyString_AsStringAndSize(v, (char **)&key.dptr,
-                                 (Py_ssize_t *)&key.dsize)) {
+    if (PyString_AsStringAndSize(v, &ptr, &size))
         return -1;
-    }
+    key.dptr = ptr;
+    key.dsize = size;
 
     /* Expand check_dbmobject_open to return -1 */
     if (dp->di_dbm == NULL) {

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list