Skip to content

Conversation

@gvanrossum
Copy link
Member

Fixes #1289. After a diff in the issue by @Brodie.

self.binder.try_frames.remove(len(self.binder.frames) - 2)
if s.else_body:
self.accept(s.else_body)
self.breaking_out = False
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect that self.breaking_out = False should be left here. I can try to come up with a test case, but if nothing breaks, I'd leave it.

@gvanrossum
Copy link
Member Author

OK, added it back. I was wondering about that; it's unclear even after scanning all the code exactly how this flag is used.

@JukkaL
Copy link
Collaborator

JukkaL commented Apr 25, 2016

The exact semantics aren't entirely clean to me either. They way I understand it is that it will be true when statements following the current statement can't be reached -- for example, after a return statement. It gets trickier when there is non-trivial control flow such as within a try statement.

@JukkaL JukkaL merged commit 42b2faa into master Apr 25, 2016
@gvanrossum gvanrossum deleted the try-else-redef branch April 25, 2016 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants