2006-11-26 | paulb | file changeset files shortlog | Introduced a CheckExc node for the specific purpose of testing exception types. Changed the processing of exception details to test explicitly for Tuple nodes and to flatten such structures in order to build CheckExc nodes, which are then used directly in testing exception types and pruning the exceptions from the current namespace. Introduced improved namespace management in Try nodes. Added a get_class convenience method in the Instance class. Improved tests. |
paulb@107 | 1 | class A: |
paulb@107 | 2 | pass |
paulb@107 | 3 | class B: |
paulb@107 | 4 | pass |
paulb@107 | 5 | class C: |
paulb@107 | 6 | pass |
paulb@122 | 7 | |
paulb@122 | 8 | def f(): |
paulb@122 | 9 | x = 1 |
paulb@122 | 10 | try: |
paulb@122 | 11 | if x: |
paulb@122 | 12 | raise A |
paulb@122 | 13 | else: |
paulb@122 | 14 | raise B |
paulb@122 | 15 | except A, e: |
paulb@122 | 16 | a = e |
paulb@122 | 17 | except (B, C), f: |
paulb@122 | 18 | a = f |
paulb@111 | 19 | else: |
paulb@122 | 20 | a = x |
paulb@133 | 21 | return a |
paulb@122 | 22 | |
paulb@122 | 23 | f() |