[Zope-dev] Re: SVN: Zope/branches/Zope-2_8-branch/ - Collector #1879: applied patch by Dieter Maurer to fix a bug in

Florent Guillaume fg at nuxeo.com
Mon Sep 26 12:31:27 EDT 2005


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

Florent


Andreas Jung  <andreas at andreas-jung.com> 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   fg at nuxeo.com


More information about the Zope-Dev mailing list