Skip to content

Commit c8d811d

Browse files
committed
Struggle with the cases generator
1 parent d6d9de8 commit c8d811d

File tree

7 files changed

+46
-22
lines changed

7 files changed

+46
-22
lines changed

Include/internal/pycore_opcode_metadata.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_uop_metadata.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/bytecodes.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3345,23 +3345,27 @@ dummy_func(
33453345
_FOR_ITER_GEN_FRAME +
33463346
_PUSH_FRAME;
33473347

3348-
op(_INSERT_NULL, (arg -- args[2])) {
3349-
args[0] = PyStackRef_NULL;
3350-
args[1] = arg;
3348+
op(_INSERT_NULL, (arg -- arg1, arg2)) {
3349+
arg1 = PyStackRef_NULL;
3350+
arg2 = arg;
33513351
DEAD(arg);
33523352
}
33533353

3354-
op(_LOAD_SPECIAL, (method_and_self[2] -- method_and_self[2])) {
3354+
op(_LOAD_SPECIAL, (null, self -- method_and_self[2])) {
3355+
method_and_self[0] = null;
3356+
method_and_self[1] = self;
33553357
PyObject *name = _Py_SpecialMethods[oparg].name;
33563358
int err = _PyObject_LookupSpecialMethod(name, method_and_self);
33573359
if (err < 0) {
33583360
if (!_PyErr_Occurred(tstate)) {
33593361
_PyErr_Format(tstate, PyExc_TypeError,
33603362
_Py_SpecialMethods[oparg].error,
33613363
PyStackRef_TYPE(method_and_self[1])->tp_name);
3364+
ERROR_NO_POP();
33623365
}
3363-
ERROR_IF(true, error);
3366+
ERROR_NO_POP();
33643367
}
3368+
INPUTS_DEAD();
33653369
}
33663370

33673371
macro(LOAD_SPECIAL) =

Python/executor_cases.c.h

Lines changed: 13 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/generated_cases.c.h

Lines changed: 14 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Python/optimizer_cases.c.h

Lines changed: 6 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/cases_generator/stack.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def pop(self, var: StackItem) -> tuple[str, Local]:
259259
else:
260260
rename = ""
261261
if not popped.in_local:
262-
# assert popped.memory_offset is not None
262+
assert popped.memory_offset is not None
263263
if var.is_array():
264264
defn = f"{var.name} = &stack_pointer[{self.top_offset.to_c()}];\n"
265265
else:

0 commit comments

Comments
 (0)