8000 Change ConditionalTypeBinder to mainly use with statements by ecprice · Pull Request #1731 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Change ConditionalTypeBinder to mainly use with statements #1731

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Jun 26, 2016
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8cd215e
Change ConditionalTypeBinder usage to mainly use with statements.
ecprice Jun 22, 2016
186dfbf
Add clear_breaking option to type binder context manager.
ecprice Jun 22, 2016
d539e6d
Fix bug with type binder and for/else
ecprice Jun 22, 2016
cfc3f2b
Fix bug with ConditionalTypeBinder and if/else.
ecprice Jun 22, 2016
09dc8f5
Remove canskip option from ConditionalTypeBinder
ecprice Jun 22, 2016
5eab5ed
Rename fallthrough to fall_through for consistency.
ecprice Jun 22, 2016
9d14b23
Comment explaining the frame_context() function.
ecprice Jun 22, 2016
a9f8ced
Keep track of whether a try/except block can fall off its end.
ecprice Jun 22, 2016
9c21fe3
Cleaner frame_context() interface.
ecprice Jun 22, 2016
88650b7
Remove unused functions
ecprice Jun 22, 2016
031c851
Switch binder contextmanager to use contextlib
ecprice Jun 22, 2016
01d98a9
Explanatory comments
ecprice Jun 23, 2016
296746b
Remove collapse_ancestry option, and always do it
ecprice Jun 23, 2016
2dc37f3
Fixes for try/finally binder
ecprice Jun 23, 2016
23e2444
Updates to binder
ecprice Jun 23, 2016
8000 b910c49
Add another test for dependencies
ecprice Jun 23, 2016
dcae0e9
Cleaner binder dependencies
ecprice Jun 23, 2016
0d830dd
Remove unused binder function update_expand
ecprice Jun 23, 2016
fc40c75
Remove broken/changed from Frame, place in binder.last_pop_*
ecprice Jun 23, 2016
0d9bcef
Move options_on_return into binder, making Frame empty
ecprice Jun 23, 2016
a396173
Formatting improvements
ecprice Jun 23, 2016
edba00f
Always clear breaking_out in pop_frame()
ecprice Jun 23, 2016
c6f1a29
cleanups
ecprice Jun 23, 2016
737ccb3
More comments
ecprice Jun 23, 2016
6a67b83
Don't crash on the function redefinition example
ecprice Jun 23, 2016
26d4ce5
Test changes
ecprice Jun 24, 2016
151dae8
Move binder into its own file.
ecprice Jun 24, 2016
458dbba
Have frame_context() preserve original binder.breaking_out
ecprice Jun 24, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Comment explaining the frame_context() function.
  • Loading branch information
ecprice committed Jun 22, 2016
commit 9d14b237f3e7dbd384dbbd01c3c7998f35e53ec0
11 changes: 11 additions & 0 deletions mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,17 @@ def pop_loop_frame(self) -> None:

def frame_context(self, fall_through: bool = False,
clear_breaking: bool = False) -> 'FrameContextManager':
"""Return a context manager that pushes/pops frames on enter/exit.

If fall_through, then allow types to escape from the inner
frame to the resulting frame. That is, the state of types at
the end of the last frame are allowed to fall through into the
enclosing frame.

If clear_breaking, then on __exit__ the manager will clear the
breaking_out flag, and if it was not set, will allow the frame
to escape to its grandparent.
"""
return FrameContextManager(self, fall_through, clear_breaking)


Expand Down
0