| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
|
||
| def compare_events(self, line_offset, events, expected_events): | ||
| events = [(l - line_offset, e) for (l, e) in events] | ||
| events = [(l - line_offset if l is not None else None, e) for (l, e) in events] |
There was a problem hiding this comment.
I introduced for debugging this PR. It is no longer strictly necessary, but it gives nicer output when tests fail.
Sorry, something went wrong.
|
|
||
| static int | ||
| wrap_in_stopiteration_handler(struct compiler *c) | ||
| { |
There was a problem hiding this comment.
I wonder if this is not wrapping too much, like the instructions that deal with the function's arguments and annotations?
Sorry, something went wrong.
There was a problem hiding this comment.
Annotations are executed in the enclosing scope, as are defaults. So there is no problem there.
MAKE_CELL and RETURN_GENERATOR instructions are inserted in the back-end so happen after this.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
In order to specialize iteration over generators and send to coroutines we need to remove the pre- and post checks from the C wrappers.
The pre-checks are largely eliminated by the the compiler and specialization.
The post-checks need to be handled in bytecode.
To do that, we wrap the generator body in a try: ... except StopIteration: ... which converts the StopIteration into a RuntimeError.
I initially did this entirely in bytecode, but it adds a lot of bulk to the bytecode.
The new STOPITERATION_ERROR instruction should only be temporary: #99005