]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #17926: Fix dbm.__contains__ on 64-bit big-endian machines.
authorAntoine Pitrou <solipsis@pitrou.net>
Tue, 7 May 2013 23:51:37 +0000 (01:51 +0200)
committerAntoine Pitrou <solipsis@pitrou.net>
Tue, 7 May 2013 23:51:37 +0000 (01:51 +0200)
Misc/NEWS
Modules/dbmmodule.c

index 7cef7ef01cba9a72ef2239a4fbd86ed387540679..466781c1225c867db7b0c89f5d242cf0be39e196 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -34,6 +34,8 @@ Core and Builtins
 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.
index f9c99a8b8f02f45b41d35a28aa0c88c02799e952..8b16def26765c39f9b744fa653dbc2f8f4a9f667 100644 (file)
@@ -168,11 +168,13 @@ static int
 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) {