diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2010-06-30 08:46:53 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2010-06-30 08:46:53 (GMT) |
commit | 81ad8ccdfbabbfbda2ad304e8dbbfec84625f485 (patch) | |
tree | ff59785f83fe72f1cdc80e10030937898ea767bc /Demo/parser/unparse.py | |
parent | 8d6d760422b56f69e57d009fa26eabcc49935afe (diff) | |
download | cpython-81ad8ccdfbabbfbda2ad304e8dbbfec84625f485.zip cpython-81ad8ccdfbabbfbda2ad304e8dbbfec84625f485.tar.gz cpython-81ad8ccdfbabbfbda2ad304e8dbbfec84625f485.tar.bz2 |
Output try-except-finally statements where appropriate.
Diffstat (limited to 'Demo/parser/unparse.py')
-rw-r--r-- | Demo/parser/unparse.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/Demo/parser/unparse.py b/Demo/parser/unparse.py index 03dd9e1..fa8f434 100644 --- a/Demo/parser/unparse.py +++ b/Demo/parser/unparse.py @@ -169,10 +169,14 @@ class Unparser: self.leave() def _TryFinally(self, t): - self.fill("try") - self.enter() - self.dispatch(t.body) - self.leave() + if len(t.body) == 1 and isinstance(t.body[0], ast.TryExcept): + # try-except-finally + self.dispatch(t.body) + else: + self.fill("try") + self.enter() + self.dispatch(t.body) + self.leave() self.fill("finally") self.enter() |