diff Modules/_dbmmodule.c @ 49848:dfeda0d3d636

dbm.gnu and dbm.ndbm accept both strings and bytes as keys and values. For the former they are converted to bytes before being written to the DB. Closes issue 3799. Reviewed by Skip Montanaro.
author Brett Cannon <bcannon@gmail.com>
date Tue, 25 Nov 2008 19:19:17 +0000
parents 8ffec372040e
children 0be10391347b
line wrap: on
line diff
--- a/Modules/_dbmmodule.c	Tue Nov 25 12:35:58 2008 +0000
+++ b/Modules/_dbmmodule.c	Tue Nov 25 19:19:17 2008 +0000
@@ -122,7 +122,7 @@
 	
         if ( !PyArg_Parse(v, "s#", &krec.dptr, &tmp_size) ) {
 		PyErr_SetString(PyExc_TypeError,
-				"dbm mappings have string keys only");
+				"dbm mappings have bytes or string keys only");
 		return -1;
 	}
 	krec.dsize = tmp_size;
@@ -140,7 +140,7 @@
 	} else {
 		if ( !PyArg_Parse(w, "s#", &drec.dptr, &tmp_size) ) {
 			PyErr_SetString(PyExc_TypeError,
-			     "dbm mappings have byte string elements only");
+			     "dbm mappings have byte or string elements only");
 			return -1;
 		}
 		drec.dsize = tmp_size;