[pypy-svn] r10346 - pypy/dist/pypy/objspace/flow

tismer at codespeak.net tismer at codespeak.net
Tue Apr 5 20:05:01 CEST 2005


Author: tismer
Date: Tue Apr  5 20:05:01 2005
New Revision: 10346

Modified:
   pypy/dist/pypy/objspace/flow/objspace.py
Log:
extended exception_match to unroll a right-hand tuple.
Works fine so far. But Samuele seems to have a better idea, let's see :-)

Modified: pypy/dist/pypy/objspace/flow/objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/objspace.py	(original)
+++ pypy/dist/pypy/objspace/flow/objspace.py	Tue Apr  5 20:05:01 2005
@@ -183,7 +183,14 @@
 
     def exception_match(self, w_exc_type, w_check_class):
         self.executioncontext.recorder.crnt_block.exc_handler = True
-        return ObjSpace.exception_match(self, w_exc_type, w_check_class)
+        if not isinstance(self.unwrap(w_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
 
     def getconstclass(space, w_cls):
         try:



More information about the Pypy-commit mailing list