-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENH: Implement support for with-blocks.
The basic idea here is rewrite the ast of the with-block into two statements and try-except, which we already know how to oneline-ify In general, we can rewrite a with block of the form: with <expr> as <ctxname>: <body> as __anonymous = <expr> <ctxname> = __anonymous.__enter__() try: <body> except: if not __anonymous.__exit__(*sys.exc_info()): raise else: __anonymous.__exit__(None, None, None)
- Loading branch information
1 parent
167dc20
commit 7285071
Showing
1 changed file
with
131 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters