Commit 1f04b980 authored by Jim Fulton's avatar Jim Fulton

I had added a check to make sure that we didn't hide programming errors

when trying to get attributes during acquisition.  For example, it was
common for acquisition to mask errors occuring when trying to load
object state from the database, since this is typically triggered by a
getattr call.  I wanted to do something like:

  try: foo.bar
  except AttributeError, v:
    if v != 'bar': raise # Bogus attribute error
    # keep looking up the acquisition tree

Unfortunately, this fails because v is (sometimes) an
instance, not a string.

For now, we'll check for attribute errors, but ingore the values.
parent d8a0fd5a
......@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
$Id: Acquisition.c,v 1.30 1999/07/28 17:59:46 jim Exp $
$Id: Acquisition.c,v 1.31 1999/08/05 21:36:50 jim Exp $
If you have questions regarding this software,
contact:
......@@ -381,7 +381,9 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
oname,filter,extra,orig,1,1);
if (r) goto acquired;
PyErr_Fetch(&r,&v,&tb);
if (r && (r != PyExc_AttributeError || PyObject_Compare(v,oname) != 0))
if (r && (r != PyExc_AttributeError
/* || PyObject_Compare(v,oname) != 0 */
))
{
PyErr_Restore(r,v,tb);
return NULL;
......@@ -415,7 +417,9 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
}
else {
PyErr_Fetch(&r,&v,&tb);
if (r != PyExc_AttributeError || PyObject_Compare(v,oname) != 0)
if (r != PyExc_AttributeError
/* || PyObject_Compare(v,oname) != 0 */
)
{
PyErr_Restore(r,v,tb);
return NULL;
......@@ -520,7 +524,9 @@ Wrapper_getattro_(Wrapper *self, PyObject *oname, int sob, int sco)
if (self->obj)
if (sob) {
PyErr_Fetch(&r,&v,&tb);
if (r != PyExc_AttributeError || PyObject_Compare(v,oname) != 0)
if (r != PyExc_AttributeError
/* || PyObject_Compare(v,oname) != 0 */
)
{
PyErr_Restore(r,v,tb);
return NULL;
......@@ -612,7 +618,9 @@ Xaq_getattro(Wrapper *self, PyObject *oname)
}
if (self->obj) {
PyErr_Fetch(&r,&v,&tb);
if (r != PyExc_AttributeError || PyObject_Compare(v,oname) != 0)
if (r != PyExc_AttributeError
/* || PyObject_Compare(v,oname) != 0 */
)
{
PyErr_Restore(r,v,tb);
return NULL;
......@@ -992,7 +1000,7 @@ void
initAcquisition()
{
PyObject *m, *d;
char *rev="$Revision: 1.30 $";
char *rev="$Revision: 1.31 $";
PURE_MIXIN_CLASS(Acquirer,
"Base class for objects that implicitly"
" acquire attributes from containers\n"
......@@ -1011,7 +1019,7 @@ initAcquisition()
/* Create the module and add the functions */
m = Py_InitModule4("Acquisition", methods,
"Provide base classes for acquiring objects\n\n"
"$Id: Acquisition.c,v 1.30 1999/07/28 17:59:46 jim Exp $\n",
"$Id: Acquisition.c,v 1.31 1999/08/05 21:36:50 jim Exp $\n",
OBJECT(NULL),PYTHON_API_VERSION);
d = PyModule_GetDict(m);
......
......@@ -33,7 +33,7 @@
USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
$Id: Acquisition.c,v 1.30 1999/07/28 17:59:46 jim Exp $
$Id: Acquisition.c,v 1.31 1999/08/05 21:36:50 jim Exp $
If you have questions regarding this software,
contact:
......@@ -381,7 +381,9 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
oname,filter,extra,orig,1,1);
if (r) goto acquired;
PyErr_Fetch(&r,&v,&tb);
if (r && (r != PyExc_AttributeError || PyObject_Compare(v,oname) != 0))
if (r && (r != PyExc_AttributeError
/* || PyObject_Compare(v,oname) != 0 */
))
{
PyErr_Restore(r,v,tb);
return NULL;
......@@ -415,7 +417,9 @@ Wrapper_acquire(Wrapper *self, PyObject *oname,
}
else {
PyErr_Fetch(&r,&v,&tb);
if (r != PyExc_AttributeError || PyObject_Compare(v,oname) != 0)
if (r != PyExc_AttributeError
/* || PyObject_Compare(v,oname) != 0 */
)
{
PyErr_Restore(r,v,tb);
return NULL;
......@@ -520,7 +524,9 @@ Wrapper_getattro_(Wrapper *self, PyObject *oname, int sob, int sco)
if (self->obj)
if (sob) {
PyErr_Fetch(&r,&v,&tb);
if (r != PyExc_AttributeError || PyObject_Compare(v,oname) != 0)
if (r != PyExc_AttributeError
/* || PyObject_Compare(v,oname) != 0 */
)
{
PyErr_Restore(r,v,tb);
return NULL;
......@@ -612,7 +618,9 @@ Xaq_getattro(Wrapper *self, PyObject *oname)
}
if (self->obj) {
PyErr_Fetch(&r,&v,&tb);
if (r != PyExc_AttributeError || PyObject_Compare(v,oname) != 0)
if (r != PyExc_AttributeError
/* || PyObject_Compare(v,oname) != 0 */
)
{
PyErr_Restore(r,v,tb);
return NULL;
......@@ -992,7 +1000,7 @@ void
initAcquisition()
{
PyObject *m, *d;
char *rev="$Revision: 1.30 $";
char *rev="$Revision: 1.31 $";
PURE_MIXIN_CLASS(Acquirer,
"Base class for objects that implicitly"
" acquire attributes from containers\n"
......@@ -1011,7 +1019,7 @@ initAcquisition()
/* Create the module and add the functions */
m = Py_InitModule4("Acquisition", methods,
"Provide base classes for acquiring objects\n\n"
"$Id: Acquisition.c,v 1.30 1999/07/28 17:59:46 jim Exp $\n",
"$Id: Acquisition.c,v 1.31 1999/08/05 21:36:50 jim Exp $\n",
OBJECT(NULL),PYTHON_API_VERSION);
d = PyModule_GetDict(m);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment