[Zodb-checkins] CVS: StandaloneZODB/ZODB - cPickleCache.c:1.67

Jeremy Hylton jeremy@zope.com
Mon, 10 Jun 2002 18:49:42 -0400


Update of /cvs-repository/StandaloneZODB/ZODB
In directory cvs.zope.org:/tmp/cvs-serv8086

Modified Files:
	cPickleCache.c 
Log Message:
Simplify cc_invalidate() because None is no longer a valid argument.


=== StandaloneZODB/ZODB/cPickleCache.c 1.66 => 1.67 ===
 {
   PyObject *inv, *key, *v;
-  int i;
+  int i = 0;
 
-  /* XXX The code supports invalidation of all objects, but it's
-     impossible for a Connection object to pass None.  The code could be
-     simplied.
+  /* Older versions of ZODB used None to mean "invalidate everything,"
+     but current Connection implementations don't ever pass None.
   */
+  assert(key != Py_None);
 
   if (PyArg_ParseTuple(args, "O!", &PyDict_Type, &inv)) {
-      for (i=0; PyDict_Next(inv, &i, &key, &v); ) 
-	  if (key == Py_None) {
-	      /* Eek some nitwit invalidated everything! */
-	      for (i=0; PyDict_Next(self->data, &i, &key, &v); )
-		  _invalidate(self, key);
-	      break;
-	  }
-	  else
-	      _invalidate(self, key);
+      while (PyDict_Next(inv, &i, &key, &v))
+	  _invalidate(self, key);
       PyDict_Clear(inv);
   }
   else {
@@ -450,9 +443,6 @@
 	  return NULL;
       if (PyString_Check(inv))
 	  _invalidate(self, inv);
-      else if (inv == Py_None)	/* All */
-	  for (i=0; PyDict_Next(self->data, &i, &key, &v); )
-	      _invalidate(self, key);
       else {
 	  int l;