PyArg_Parse weirds

Just van Rossum just at letterror.com
Tue Apr 24 12:43:00 EDT 2001


Robin Becker wrote:

> OK I figured out that PyArg_Parse seems to know about an existing error so I needed to
> clear the existing error condition with PyErr_Clear ie
> 
>         else if(PyObject_HasAttrString(value,"red")
>                         && PyObject_HasAttrString(value,"green")
>                         && PyObject_HasAttrString(value,"blue")){
>                 double  r, g, b;
>                 PyObject *v;
>                 PyErr_Clear();  /*needed this here else i==0 in pyArg_Parse call*/
>                 v = PyObject_GetAttrString(value,"red");
>                 i = PyArg_Parse(v,"d",&r);

Wouldn't it make sense to figure out where the original exception is raised, and
clear it there? Now it looks like you're possibly masking a real error.

Just



More information about the Python-list mailing list