Author: guido.van.rossum
Date: Fri Nov  2 20:37:59 2007
New Revision: 58788

Modified:
   python/branches/py3k-pep3137/Modules/_bsddb.c
Log:
Fix a bytes dependency in _bsddb.c.
More needs to be done before it passes all its tests though...


Modified: python/branches/py3k-pep3137/Modules/_bsddb.c
==============================================================================
--- python/branches/py3k-pep3137/Modules/_bsddb.c       (original)
+++ python/branches/py3k-pep3137/Modules/_bsddb.c       Fri Nov  2 20:37:59 2007
@@ -1287,13 +1287,16 @@
         else if (PyInt_Check(result)) {
             retval = PyInt_AsLong(result);
         }
-        else if (PyBytes_Check(result)) {
+        else if (PyBytes_Check(result) || PyString_Check(result)) {
             char* data;
             Py_ssize_t size;
 
             CLEAR_DBT(*secKey);
-            size = PyBytes_Size(result);
-            data = PyBytes_AsString(result);
+            size = Py_Size(result);
+            if (PyBytes_Check(result))
+                data = PyBytes_AS_STRING(result);
+            else
+                data = PyString_AS_STRING(result);
             secKey->flags = DB_DBT_APPMALLOC;   /* DB will free */
             secKey->data = malloc(size);        /* TODO, check this */
            if (secKey->data) {
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to