Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
7fb598a
Add macro() and op() DSL features
gvanrossum Nov 14, 2022
edae5af
Improve code generation for super/macro instructions
gvanrossum Nov 15, 2022
881357e
Move super code generation into a helper
gvanrossum Nov 16, 2022
0f12c40
Reduce the fiddling with integers in super analysis
gvanrossum Nov 16, 2022
babdbf9
Do the super/macro analysis at analysis time
gvanrossum Nov 16, 2022
2fa0a04
Convert WITH_EXCEPT_START, fix generator to make it work
gvanrossum Nov 16, 2022
cb0c874
Fix lexer to balk at unrecognized characters, e.g. '@'
gvanrossum Nov 16, 2022
fe0d336
Fix typo in comment
gvanrossum Nov 17, 2022
d84a5c3
Code review from GH-99526
gvanrossum Nov 18, 2022
d7ad950
Fix moved output names; support object pointers in cache
gvanrossum Nov 18, 2022
a034675
Tune README
gvanrossum Nov 18, 2022
1aafac8
Introduce error() method to print errors
gvanrossum Nov 18, 2022
20062f4
Check components of super/macro ops
gvanrossum Nov 18, 2022
7194723
Fix crash when WITH_EXCEPT_START errors out
gvanrossum Nov 18, 2022
cb62653
Merge branch 'main' into macro-ops
gvanrossum Nov 19, 2022
b74aa6a
Don't use typing.Dict
gvanrossum Nov 22, 2022
a0feff9
Kill more "unused" literals
gvanrossum Nov 22, 2022
a2e9991
Don't over-use f-strings
gvanrossum Nov 22, 2022
240126b
Avoid compiler warning on unused variable
gvanrossum Nov 22, 2022
6640706
Merge remote-tracking branch 'origin/main' into macro-ops
gvanrossum Nov 22, 2022
7afa58c
Introduce read_uint16(p) as equivalent to *p
gvanrossum Nov 22, 2022
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
Fix crash when WITH_EXCEPT_START errors out
This was popping the common items off the stack.
  • Loading branch information
gvanrossum committed Nov 18, 2022
commit 7194723b96beb05f966a6ba6a0eadea0a095bf9f
9 changes: 5 additions & 4 deletions Python/bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ do { \
static PyObject *value, *value1, *value2, *left, *right, *res, *sum, *prod, *sub;
static PyObject *container, *start, *stop, *v, *lhs, *rhs;
static PyObject *list, *tuple, *dict;
static PyObject *exit_func, *lasti, *val;

static PyObject *
dummy_func(
Expand Down Expand Up @@ -2726,10 +2727,10 @@ dummy_func(

inst(WITH_EXCEPT_START, (exit_func, lasti, unused, val -- exit_func, lasti, unused, val, res)) {
/* At the top of the stack are 4 values:
- TOP = exc_info()
- SECOND = previous exception
- THIRD: lasti of exception in exc_info()
- FOURTH: the context.__exit__ bound method
- val: TOP = exc_info()
- unused: SECOND = previous exception
- lasti: THIRD = lasti of exception in exc_info()
- exit_func: FOURTH = the context.__exit__ bound method
We call FOURTH(type(TOP), TOP, GetTraceback(TOP)).
Then we push the __exit__ return value.
*/
Expand Down
10 changes: 5 additions & 5 deletions Python/generated_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Tools/cases_generator/generate_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,13 @@ def write_body(self, f: typing.TextIO, ndent: str, dedent: int) -> None:
# The code block is responsible for DECREF()ing them.
# NOTE: If the label doesn't exist, just add it to ceval.c.
ninputs = len(self.input_effects)
# Don't pop common input/output effects at the bottom!
# These aren't DECREF'ed so they can stay.
for ieff, oeff in zip(self.input_effects, self.output_effects):
if ieff.name == oeff.name:
ninputs -= 1
else:
break
if ninputs:
f.write(f"{space}if ({cond}) goto pop_{ninputs}_{label};\n")
else:
Expand Down