Title: [commits] (vajda) [15918] applied patch for bug 11421

Diff

Modified: trunk/internal/chandlerdb/Makefile (15917 => 15918)

--- trunk/internal/chandlerdb/Makefile	2007-11-27 05:18:07 UTC (rev 15917)
+++ trunk/internal/chandlerdb/Makefile	2007-11-27 05:27:23 UTC (rev 15918)
@@ -1,5 +1,5 @@
 
-RELVER=0.7-$(BRANCH_REV_PREFIX)29
+RELVER=0.7-$(BRANCH_REV_PREFIX)30
 CHANDLERDB=$(INTERNAL)/chandlerdb
 DB_VER=4.6
 SRC=""

Modified: trunk/internal/chandlerdb/chandlerdb/item/ItemError.py (15917 => 15918)

--- trunk/internal/chandlerdb/chandlerdb/item/ItemError.py	2007-11-27 05:18:07 UTC (rev 15917)
+++ trunk/internal/chandlerdb/chandlerdb/item/ItemError.py	2007-11-27 05:27:23 UTC (rev 15918)
@@ -118,7 +118,7 @@
 
 
 class NoValueForAttributeError(AttributeError, ItemError):
-    __doc__ = "%s (Kind: %s) has no value for '%s'"
+    __doc__ = "%s (%s) has no value for '%s'"
 
     def getAttribute(self):
         return self.args[1]
@@ -130,7 +130,7 @@
 
 
 class NoLocalValueForAttributeError(NoValueForAttributeError):
-    __doc__ = "%s (Kind: %s) has no local value for '%s'"
+    __doc__ = "%s (%s) has no local value for '%s'"
     
     def __str__(self):
         return self.__doc__ %(self.getItem()._repr_(),
@@ -138,6 +138,16 @@
                               self.getAttribute())
 
 
+class NoDescriptorForAttributeError(AttributeError, ItemError):
+    __doc__ = "%s of %s (%s) has no descriptor for attribute '%s'"
+    
+    def __str__(self):
+        return self.__doc__ %(type(self.getItem()),
+                              self.getItem()._repr_(),
+                              self.getItem()._kind,
+                              self.getAttribute())
+
+
 class ReadOnlyAttributeError(AttributeError, ItemError):
     __doc__ = 'Item %s: value for %s is read-only'
 

Modified: trunk/internal/chandlerdb/chandlerdb/item/c.c (15917 => 15918)

--- trunk/internal/chandlerdb/chandlerdb/item/c.c	2007-11-27 05:18:07 UTC (rev 15917)
+++ trunk/internal/chandlerdb/chandlerdb/item/c.c	2007-11-27 05:27:23 UTC (rev 15918)
@@ -34,6 +34,8 @@
 PyTypeObject *ReadOnlyAttributeError = NULL;
 PyTypeObject *ChangeDuringCommitError = NULL;
 PyTypeObject *KindlessItemError = NULL;
+PyTypeObject *NoLocalValueForAttributeError = NULL;
+PyTypeObject *NoDescriptorForAttributeError = NULL;
 PyTypeObject *CView = NULL;
 PyObject *Nil = NULL;
 PyObject *Default = NULL;
@@ -184,6 +186,8 @@
     LOAD_TYPE(m, ReadOnlyAttributeError);
     LOAD_TYPE(m, ChangeDuringCommitError);
     LOAD_TYPE(m, KindlessItemError);
+    LOAD_TYPE(m, NoLocalValueForAttributeError);
+    LOAD_TYPE(m, NoDescriptorForAttributeError);
     Py_DECREF(m);
 
     if (!(m = PyImport_ImportModule("chandlerdb.schema.c")))

Modified: trunk/internal/chandlerdb/chandlerdb/item/c.h (15917 => 15918)

--- trunk/internal/chandlerdb/chandlerdb/item/c.h	2007-11-27 05:18:07 UTC (rev 15917)
+++ trunk/internal/chandlerdb/chandlerdb/item/c.h	2007-11-27 05:27:23 UTC (rev 15918)
@@ -57,6 +57,8 @@
 extern PyTypeObject *ReadOnlyAttributeError;
 extern PyTypeObject *ChangeDuringCommitError;
 extern PyTypeObject *KindlessItemError;
+extern PyTypeObject *NoLocalValueForAttributeError;
+extern PyTypeObject *NoDescriptorForAttributeError;
 extern PyTypeObject *CView;
 
 extern PyObject *Nil;

Modified: trunk/internal/chandlerdb/chandlerdb/item/item.c (15917 => 15918)

--- trunk/internal/chandlerdb/chandlerdb/item/item.c	2007-11-27 05:18:07 UTC (rev 15917)
+++ trunk/internal/chandlerdb/chandlerdb/item/item.c	2007-11-27 05:27:23 UTC (rev 15918)
@@ -779,7 +779,10 @@
         return defaultValue;
     }
 
-    PyErr_SetObject(PyExc_AttributeError, name);
+    value = PyTuple_Pack(2, self, name);
+    PyErr_SetObject((PyObject *) NoLocalValueForAttributeError, value);
+    Py_DECREF(value);
+
     return NULL;
 }
 
@@ -956,7 +959,12 @@
 
             if (!descriptor)
             {
-                PyErr_SetObject(PyExc_AttributeError, name);
+                PyObject *tuple = PyTuple_Pack(2, self, name);
+
+                PyErr_SetObject((PyObject *) NoDescriptorForAttributeError,
+                                tuple);
+                Py_DECREF(tuple);
+
                 return NULL;
             }
 

Modified: trunk/internal/chandlerdb/chandlerdb/schema/c.c (15917 => 15918)

--- trunk/internal/chandlerdb/chandlerdb/schema/c.c	2007-11-27 05:18:07 UTC (rev 15917)
+++ trunk/internal/chandlerdb/chandlerdb/schema/c.c	2007-11-27 05:27:23 UTC (rev 15918)
@@ -28,7 +28,8 @@
 PyTypeObject *CValues = NULL;
 PyTypeObject *CLinkedMap = NULL;
 PyTypeObject *PersistentSequence = NULL;
-PyObject *PyExc_StaleItemError = NULL;
+PyTypeObject *StaleItemError = NULL;
+PyTypeObject *NoValueForAttributeError = NULL;
 PyObject *True_TUPLE = NULL;
 PyObject *Empty_TUPLE = NULL;
 PyObject *Empty = NULL;
@@ -79,7 +80,8 @@
 
     if (!(m = PyImport_ImportModule("chandlerdb.item.ItemError")))
         return;
-    PyExc_StaleItemError = PyObject_GetAttrString(m, "StaleItemError");
+    LOAD_TYPE(m, StaleItemError);
+    LOAD_TYPE(m, NoValueForAttributeError);
     Py_DECREF(m);
     
     if (!(m = PyImport_ImportModule("chandlerdb.item.c")))

Modified: trunk/internal/chandlerdb/chandlerdb/schema/c.h (15917 => 15918)

--- trunk/internal/chandlerdb/chandlerdb/schema/c.h	2007-11-27 05:18:07 UTC (rev 15917)
+++ trunk/internal/chandlerdb/chandlerdb/schema/c.h	2007-11-27 05:27:23 UTC (rev 15918)
@@ -41,7 +41,8 @@
 extern PyTypeObject *CValues;
 extern PyTypeObject *CLinkedMap;
 extern PyTypeObject *PersistentSequence;
-extern PyObject *PyExc_StaleItemError;
+extern PyTypeObject *StaleItemError;
+extern PyTypeObject *NoValueForAttributeError;
 extern PyObject *True_TUPLE, *Empty_TUPLE;
 extern PyObject *Empty;
 

Modified: trunk/internal/chandlerdb/chandlerdb/schema/descriptor.c (15917 => 15918)

--- trunk/internal/chandlerdb/chandlerdb/schema/descriptor.c	2007-11-27 05:18:07 UTC (rev 15917)
+++ trunk/internal/chandlerdb/chandlerdb/schema/descriptor.c	2007-11-27 05:27:23 UTC (rev 15918)
@@ -190,7 +190,7 @@
     }
     else if (item->status & STALE)
     {
-        PyErr_SetObject(PyExc_StaleItemError, (PyObject *) item);
+        PyErr_SetObject((PyObject *) StaleItemError, (PyObject *) item);
         return NULL;
     }
     else
@@ -272,15 +272,26 @@
                     Py_INCREF(value);
                 }
                 else
-                    PyErr_SetObject(PyExc_AttributeError, self->name);
-            }                    
+                {
+                    PyObject *tuple = PyTuple_Pack(2, item, self->name);
+
+                    PyErr_SetObject((PyObject *) NoValueForAttributeError,
+                                    tuple);
+                    Py_DECREF(tuple);
+                }
+            }
             else
                 value = PyObject_CallMethodObjArgs((PyObject *) item, getAttributeValue_NAME, self->name, attrDict, attr->attrID, NULL);
 
             return value;
         }
 
-        PyErr_SetObject(PyExc_AttributeError, self->name);
+        {
+            PyObject *tuple = PyTuple_Pack(2, item, self->name);
+
+            PyErr_SetObject((PyObject *) NoValueForAttributeError, tuple);
+            Py_DECREF(tuple);
+        }
         return NULL;
     }
 }
@@ -295,7 +306,7 @@
     }
     else if (item->status & STALE)
     {
-        PyErr_SetObject(PyExc_StaleItemError, (PyObject *) item);
+        PyErr_SetObject((PyObject *) StaleItemError, (PyObject *) item);
         return -1;
     }
     else if (value == NULL)




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to