[Python-checkins] python/dist/src/Modules _bsddb.c,1.25,1.26

niemeyer at users.sourceforge.net niemeyer at users.sourceforge.net
Tue Jan 20 10:14:58 EST 2004


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv18424

Modified Files:
	_bsddb.c 
Log Message:
Fixing #880531: raise TypeError when trying to use a None key with RECNO
or QUEUE database.


Index: _bsddb.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_bsddb.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** _bsddb.c	3 Nov 2003 21:35:31 -0000	1.25
--- _bsddb.c	20 Jan 2004 15:14:55 -0000	1.26
***************
*** 350,353 ****
--- 350,360 ----
      CLEAR_DBT(*key);
      if (keyobj == Py_None) {  /* TODO: is None really okay for keys? */
+         type = _DB_get_type(self);
+         if (type == DB_RECNO || type == DB_QUEUE) {
+             PyErr_SetString(
+                 PyExc_TypeError,
+                 "None keys not allowed for Recno and Queue DB's");
+             return 0;
+         }
          /* no need to do anything, the structure has already been zeroed */
      }





More information about the Python-checkins mailing list