[Freeassociation-libical] Error catching in Python

Matthias Urlichs smurf at smurf.noris.de
Wed Jul 7 07:57:09 PDT 2004


Hi,

error recovery in the Python interface is broken.

I don't know how best toi handle this, as all error handling depends 
on having the FATAL flag set (no if-error-return anywhere).

The best idea I can come up with is to handle this by implementing a
thread-specific longjmp hook.

Comments?


Running test.py (I have turned the fatal error flag off, otherwise
it'd abort):

(gdb) set env LD_LIBRARY_PATH ../libical/.libs/:../libicalss/.libs/:../libicalvcal/.libs
(gdb) set env PYTHONPATH build/lib.linux-i686-2.3/
(gdb) r test.py
Starting program: /usr/bin/python2.3 test.py
(no debugging symbols found)...(no debugging symbols found)...[Thread debugging using libthread_db enabled]
[New Thread 1075446880 (LWP 6378)]
(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...(no debugging symbols found)...--------------------------- Test Property ----------------------
ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:MAILTO:
 employee-A at host.com

MAILTO:employee-A at host.com

Parameters:
   RSVP  =  TRUE
   ROLE  =  REQ-PARTICIPANT
   CUTYPE  =  GROUP

REQ-PARTICIPANT
INDIVIDUAL
GROFROMBLATZ

Wolverine
MAILTO:employee-A at host.com
mailto:Bob at bob.com
ATTENDEE;RSVP=TRUE;CUTYPE=GROUP;ROLE=GROFROMBLATZ;
 X-MAN-FAVOURITE=Wolverine;X-FILES-FAVOURITE=Mulder:mailto:Bob at bob.com

ATTENDEE;RSVP=TRUE;CUTYPE=GROUP;X-FILES-FAVOURITE=Mulder:mailto:
 Bob at bob.com


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1075446880 (LWP 6378)]
icalvalue_get_text (value=0x0) at icalderivedvalue.c:302
302         return ((struct icalvalue_impl*)value)->data.v_string;
(gdb) l
297     }
298     const char* icalvalue_get_text(const icalvalue* value) {
299
300         icalerror_check_arg( (value!=0),"value");
301         icalerror_check_value_type(value, ICAL_TEXT_VALUE);
302         return ((struct icalvalue_impl*)value)->data.v_string;
303     }
304
305
306
(gdb) fr 1
#1  0x4049b7fe in icalproperty_get_name (prop=0x81b85d8)
    at icalderivedproperty.c:1667
1667        return icalvalue_get_text(icalproperty_get_value(prop));
(gdb) l
1662        icalerror_check_arg_rv( (prop!=0),"prop");
1663        icalproperty_set_value(prop,icalvalue_new_text(v));
1664    }
1665    const char* icalproperty_get_name(const icalproperty* prop){
1666        icalerror_check_arg( (prop!=0),"prop");
1667        return icalvalue_get_text(icalproperty_get_value(prop));
1668    }
1669    icalproperty* icalproperty_vanew_organizer(const char* v, ...){
1670       va_list args;
1671       struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ORGANIZER_PROPERTY);   icalerror_check_arg_rz( (v!=0),"v");
(gdb) p *prop
$1 = {id = "prop", kind = ICAL_X_PROPERTY, x_name = 0x81a4ed0 "X-COMMENT",
  parameters = 0x81813e0, parameter_iterator = 0x0, value = 0x0, parent = 0x0}
(gdb)

-- 
Matthias Urlichs   |   {M:U} IT Design @ m-u-it.de   |  smurf at smurf.noris.de




More information about the libical-interest mailing list