Esempio n. 1
0
 def exception_match(self, w_exc_type, w_check_class):
     try:
         check_class = self.unwrap(w_check_class)
     except UnwrapException:
         raise Exception, "non-constant except guard"
     if not isinstance(check_class, tuple):
         # the simple case
         return ObjSpace.exception_match(self, w_exc_type, w_check_class)
     # checking a tuple of classes
     for w_klass in self.viewiterable(w_check_class):
         if ObjSpace.exception_match(self, w_exc_type, w_klass):
             return True
     return False
Esempio n. 2
0
 def exception_match(self, w_exc_type, w_check_class):
     try:
         check_class = self.unwrap(w_check_class)
     except UnwrapException:
         raise Exception, "non-constant except guard"
     if not isinstance(check_class, tuple):
         # the simple case
         return ObjSpace.exception_match(self, w_exc_type, w_check_class)
     # checking a tuple of classes
     for w_klass in self.unpacktuple(w_check_class):
         if ObjSpace.exception_match(self, w_exc_type, w_klass):
             return True
     return False
Esempio n. 3
0
 def exception_match(self, w_exc_type, w_check_class):
     try:
         check_class = self.unwrap(w_check_class)
     except UnwrapException:
         raise Exception, "non-constant except guard"
     if check_class in (NotImplementedError, AssertionError):
         raise error.FlowingError("Catching %s is not valid in RPython" % check_class.__name__)
     if not isinstance(check_class, tuple):
         # the simple case
         return ObjSpace.exception_match(self, w_exc_type, w_check_class)
     # special case for StackOverflow (see rlib/rstackovf.py)
     if check_class == rstackovf.StackOverflow:
         w_real_class = self.wrap(rstackovf._StackOverflow)
         return ObjSpace.exception_match(self, w_exc_type, w_real_class)
     # checking a tuple of classes
     for w_klass in self.fixedview(w_check_class):
         if self.exception_match(w_exc_type, w_klass):
             return True
     return False
Esempio n. 4
0
 def exception_match(self, w_exc_type, w_check_class):
     try:
         check_class = self.unwrap(w_check_class)
     except UnwrapException:
         raise Exception, "non-constant except guard"
     if check_class in (NotImplementedError, AssertionError):
         raise error.FlowingError("Catching %s is not valid in RPython" %
                                  check_class.__name__)
     if not isinstance(check_class, tuple):
         # the simple case
         return ObjSpace.exception_match(self, w_exc_type, w_check_class)
     # special case for StackOverflow (see rlib/rstackovf.py)
     if check_class == rstackovf.StackOverflow:
         w_real_class = self.wrap(rstackovf._StackOverflow)
         return ObjSpace.exception_match(self, w_exc_type, w_real_class)
     # checking a tuple of classes
     for w_klass in self.fixedview(w_check_class):
         if self.exception_match(w_exc_type, w_klass):
             return True
     return False