mirror of
https://github.com/python/cpython.git
synced 2025-07-28 05:34:31 +00:00
Output try-except-finally statements where appropriate.
This commit is contained in:
parent
8d6d760422
commit
81ad8ccdfb
2 changed files with 23 additions and 5 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue