PyArg_Parse weirds
Robin Becker
robin at jessikat.fsnet.co.uk
Tue Apr 24 13:11:28 EDT 2001
In article <3AE5AD13.2090A47E at letterror.com>, Just van Rossum
<just at letterror.com> writes
>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
no I was testing for another possible value and when that fails I try a
secondd argument type; I just didn't realise that PyArg_Parse would barf
if an error was already set.
--
Robin Becker
More information about the Python-list
mailing list