This is the kind of thing that would *really* benefit from having unit
tests...

Florent


Andreas Jung  <[EMAIL PROTECTED]> wrote:
> Log message for revision 38586:
>         - Collector #1879: applied patch by Dieter Maurer to fix a bug in 
>           ac_aquire() ignoring the default argument
>   
> 
> Changed:
>   U   Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
>   U   Zope/branches/Zope-2_8-branch/lib/python/Acquisition/_Acquisition.c
> 
> -=-
> Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
> ===================================================================
> --- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt     2005-09-24 12:01:37 UTC
> (rev 38585)
> +++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt     2005-09-24 12:10:07 UTC
> (rev 38586)
> @@ -31,6 +31,9 @@
>  
>      Bugs Fixed
>  
> +      - Collector #1879: applied patch by Dieter Maurer to fix a bug in 
> +        ac_aquire() ignoring the default argument
> +
>        - Collector #1864, #1906: fixed header normalization in appendHeader()
>  
>        - Collector #1899: fixed migration issue when using export/import for
> 
> Modified: Zope/branches/Zope-2_8-branch/lib/python/Acquisition/_Acquisition.c
> ===================================================================
> --- Zope/branches/Zope-2_8-branch/lib/python/Acquisition/_Acquisition.c
> 2005-09-24 12:01:37 UTC (rev 38585)
> +++ Zope/branches/Zope-2_8-branch/lib/python/Acquisition/_Acquisition.c
> 2005-09-24 12:10:07 UTC (rev 38586)
> @@ -1059,6 +1059,7 @@
>    PyObject *expl=0, *defalt=0;
>    int explicit=1;
>    int containment=0;
> +  PyObject *result; /* DM 2005-08-25: argument "default" ignored */
>  
>    UNLESS (PyArg_ParseTupleAndKeywords(
>            args, kw, "O|OOOOi", acquire_args+1,
> @@ -1070,12 +1071,34 @@
>  
>    if (filter==Py_None) filter=0;
>  
> +  /* DM 2005-08-25: argument "default" ignored -- fix it! */
> +# if 0
>    return Wrapper_findattr(self,name,filter,extra,OBJECT(self),1,
>                         explicit || 
>                         self->ob_type==(PyTypeObject*)&Wrappertype,
>                         explicit, containment);
> +# else
> +  result = Wrapper_findattr(self,name,filter,extra,OBJECT(self),1,
> +                       explicit || 
> +                       self->ob_type==(PyTypeObject*)&Wrappertype,
> +                       explicit, containment);
> +  if (result == NULL && defalt != NULL) {
> +    /* as "Python/bltinmodule.c:builtin_getattr" turn
> +       only 'AttributeError' into a default value, such
> +       that e.g. "ConflictError" and errors raised by the filter
> +       are not mapped to the default value.
> +    */
> +    if (PyErr_ExceptionMatches(PyExc_AttributeError)) {
> +      PyErr_Clear();
> +      Py_INCREF(defalt);
> +      result = defalt;
> +    }
> +  }
> +  return result;
> +# endif
>  }
>  
> +
>  static PyObject *
>  Wrapper_inContextOf(Wrapper *self, PyObject *args)
>  {


-- 
Florent Guillaume, Nuxeo (Paris, France)   CTO, Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   [EMAIL PROTECTED]
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to