From: Stefan Behnel on
moerchendiser2k3, 16.03.2010 19:25:
> Hi, currently I am not at home, I will post some stuff when I am back.
> Just the note: I throw an exception with the C API.
>
> Looks like that
>
>
> PyObject *result = PyObject_Call(my_isntance, "", NULL);
> if(result==NULL)
> {
> PyErr_Print(); //when this happens, the traceback is correct with
> information about the file/line
> return;
> }
>
> if(!PyXYZ_Check(result))
> {
> PyErr_SetString(PyExc_TypeError, "Wrong type, ....");
> PyErr_Print(); //missing information of the file/line.
> return;
> }
>
> Well, I expect, that there are no information about the line/file, so
> I know something is missing, but what is missing?

Two solutions here:

1) put the line number information into the message string when you raise
the exception

2) use Cython instead of plain C, as Cython will automatically generate
readable stack traces for you, also for non-Python functions.

Stefan

From: moerchendiser2k3 on
> 1) put the line number information into the message string when you raise
> the exception


you mean the line and file information of the C code, right?
From: Stefan Behnel on
moerchendiser2k3, 17.03.2010 23:35:
>> 1) put the line number information into the message string when you raise
>> the exception
>
> you mean the line and file information of the C code, right?

Funny that you (being the OP) ask *me* what kind of line information *you*
want.

Stefan

From: moerchendiser2k3 on
> Funny that you (being the OP) ask *me* what kind of line information *you*
> want.
>
> Stefan

Well, I need the line/file information of Python :
From: Stefan Behnel on
moerchendiser2k3, 18.03.2010 14:58:
>> Funny that you (being the OP) ask *me* what kind of line information *you*
>> want.
>>
>> Stefan
>
> Well, I need the line/file information of Python :

Then please explain what kind of Python line number you expect to find in C
code.

Hint: providing details often results in getting helpful answers.

Stefan