cvsuser     05/01/05 16:42:06

  Modified:    dynclasses pybuiltin.pmc pydict.pmc pytype.pmc
               include/parrot exceptions.h
               src      exceptions.c inter_run.c
  Log:
  Exception fixes (more work needs to be done on exceptions and generators)
  
  Revision  Changes    Path
  1.43      +9 -7      parrot/dynclasses/pybuiltin.pmc
  
  Index: pybuiltin.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/dynclasses/pybuiltin.pmc,v
  retrieving revision 1.42
  retrieving revision 1.43
  diff -u -r1.42 -r1.43
  --- pybuiltin.pmc     4 Jan 2005 20:46:07 -0000       1.42
  +++ pybuiltin.pmc     6 Jan 2005 00:42:04 -0000       1.43
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: pybuiltin.pmc,v 1.42 2005/01/04 20:46:07 rubys Exp $
  +$Id: pybuiltin.pmc,v 1.43 2005/01/06 00:42:04 rubys Exp $
   
   =head1 NAME
   
  @@ -519,19 +519,21 @@
   
       METHOD PMC* hasattr(PMC *object, PMC *name) {
           PMC *ret = pmc_new(INTERP, PyBuiltin_PyBoolean);
  +        VTABLE_set_integer_native(INTERP, ret, 0);
           new_internal_exception(INTERP);
           push_new_c_exception_handler(INTERP, INTERP->exceptions);
           if (!setjmp(INTERP->exceptions->destination)) {
  -            VTABLE_get_attr_str(INTERP, object,
  +            PMC *attr = VTABLE_get_attr_str(INTERP, object,
                   VTABLE_get_string(INTERP, name));
  -            VTABLE_set_integer_native(INTERP, ret, 1);
  +            if (attr && VTABLE_defined(INTERP, attr))
  +                VTABLE_set_integer_native(INTERP, ret, 1);
           } else {
  -            Parrot_exception *exception = INTERP->exceptions;
  -            if (exception->error != E_AttributeError) {
  -                rethrow_c_exception(INTERP);
  +            if (INTERP->exceptions->error != E_AttributeError) {
  +                handle_exception(INTERP);
               }
  -            VTABLE_set_integer_native(INTERP, ret, 0);
           }
  +        pop_exception(INTERP);
  +        free_internal_exception(INTERP);
           return ret;
       }
   
  
  
  
  1.18      +2 -2      parrot/dynclasses/pydict.pmc
  
  Index: pydict.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/dynclasses/pydict.pmc,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- pydict.pmc        29 Dec 2004 14:12:18 -0000      1.17
  +++ pydict.pmc        6 Jan 2005 00:42:04 -0000       1.18
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: pydict.pmc,v 1.17 2004/12/29 14:12:18 rubys Exp $
  +$Id: pydict.pmc,v 1.18 2005/01/06 00:42:04 rubys Exp $
   
   =head1 NAME
   
  @@ -272,7 +272,7 @@
                                           key);
           if (b == NULL) {
               real_exception(INTERP, NULL, E_KeyError,
  -                "KeyError: %Ss", VTABLE_get_string(INTERP, key));
  +                "KeyError: %Ss", VTABLE_get_repr(INTERP, key));
           }
           nextkey = key_next(INTERP, key);
           if (!nextkey)
  
  
  
  1.14      +2 -5      parrot/dynclasses/pytype.pmc
  
  Index: pytype.pmc
  ===================================================================
  RCS file: /cvs/public/parrot/dynclasses/pytype.pmc,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- pytype.pmc        3 Jan 2005 16:16:02 -0000       1.13
  +++ pytype.pmc        6 Jan 2005 00:42:04 -0000       1.14
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: pytype.pmc,v 1.13 2005/01/03 16:16:02 rubys Exp $
  +$Id: pytype.pmc,v 1.14 2005/01/06 00:42:04 rubys Exp $
   
   =head1 NAME
   
  @@ -92,11 +92,8 @@
           }
   
           if (!attr || !VTABLE_defined(INTERP, attr)) {
  -            STRING *message;
  -            message = Parrot_sprintf_c(INTERP, "AttributeError: %s",
  -                string_to_cstring(INTERP, idx));
               real_exception(INTERP, NULL, E_AttributeError,
  -                string_to_cstring(INTERP, message));
  +                "AttributeError: %Ss", idx);
           }
   
           return attr;
  
  
  
  1.53      +2 -1      parrot/include/parrot/exceptions.h
  
  Index: exceptions.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/exceptions.h,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- exceptions.h      8 Dec 2004 13:20:38 -0000       1.52
  +++ exceptions.h      6 Jan 2005 00:42:05 -0000       1.53
  @@ -1,7 +1,7 @@
   /* exceptions.h
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: exceptions.h,v 1.52 2004/12/08 13:20:38 leo Exp $
  + *     $Id: exceptions.h,v 1.53 2005/01/06 00:42:05 rubys Exp $
    *  Overview:
    *     define the internal interpreter exceptions
    *  Data Structure and Algorithms:
  @@ -171,6 +171,7 @@
    */
   void do_exception(Parrot_Interp, exception_severity severity, long error);
   void new_internal_exception(Parrot_Interp);
  +void free_internal_exception(Parrot_Interp);
   
   /*
    * control stack marks and action
  
  
  
  1.69      +21 -1     parrot/src/exceptions.c
  
  Index: exceptions.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/exceptions.c,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- exceptions.c      12 Dec 2004 23:03:49 -0000      1.68
  +++ exceptions.c      6 Jan 2005 00:42:06 -0000       1.69
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: exceptions.c,v 1.68 2004/12/12 23:03:49 chromatic Exp $
  +$Id: exceptions.c,v 1.69 2005/01/06 00:42:06 rubys Exp $
   
   =head1 NAME
   
  @@ -595,6 +595,26 @@
   /*
   
   =item C<void
  +free_internal_exception(Interp * interpreter)>
  +
  +Place internal exception buffer back on the free list.
  +
  +=cut
  +
  +*/
  +
  +void
  +free_internal_exception(Interp * interpreter)
  +{
  +    Parrot_exception *e = interpreter->exceptions;
  +    interpreter->exceptions = e->prev;
  +    e->prev = interpreter->exc_free_list;
  +    interpreter->exc_free_list = e;
  +}
  +
  +/*
  +
  +=item C<void
   do_exception(Interp * interpreter,
           exception_severity severity, long error)>
   
  
  
  
  1.28      +2 -5      parrot/src/inter_run.c
  
  Index: inter_run.c
  ===================================================================
  RCS file: /cvs/public/parrot/src/inter_run.c,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- inter_run.c       22 Dec 2004 01:59:09 -0000      1.27
  +++ inter_run.c       6 Jan 2005 00:42:06 -0000       1.28
  @@ -1,6 +1,6 @@
   /*
   Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
  -$Id: inter_run.c,v 1.27 2004/12/22 01:59:09 chromatic Exp $
  +$Id: inter_run.c,v 1.28 2005/01/06 00:42:06 rubys Exp $
   
   =head1 NAME
   
  @@ -85,10 +85,7 @@
        * s. above
        */
       if (STACKED_EXCEPTIONS) {
  -        Parrot_exception *e = interpreter->exceptions;
  -        interpreter->exceptions = e->prev;
  -        e->prev = interpreter->exc_free_list;
  -        interpreter->exc_free_list = e;
  +        free_internal_exception(interpreter);
       }
       interpreter->ctx.runloop_level--;
       /*
  
  
  

Reply via email to