Skip to content

Commit

Permalink
pythongh-115419: Change default sym to not_null (pythonGH-116562)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fidget-Spinner committed Mar 13, 2024
1 parent fcd49b4 commit 617aca9
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 94 deletions.
4 changes: 2 additions & 2 deletions Lib/test/test_generated_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ def test_overridden_abstract_args(self):
case OP2: {
_Py_UopsSymbol *out;
out = sym_new_unknown(ctx);
out = sym_new_not_null(ctx);
if (out == NULL) goto out_of_space;
stack_pointer[-1] = out;
break;
Expand All @@ -933,7 +933,7 @@ def test_no_overridden_case(self):
output = """
case OP: {
_Py_UopsSymbol *out;
out = sym_new_unknown(ctx);
out = sym_new_not_null(ctx);
if (out == NULL) goto out_of_space;
stack_pointer[-1] = out;
break;
Expand Down
9 changes: 8 additions & 1 deletion Python/optimizer_bytecodes.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,14 @@ dummy_func(void) {
}
}

op(_LOAD_ATTR, (owner -- attr, self_or_null if (oparg & 1))) {
(void)owner;
OUT_OF_SPACE_IF_NULL(attr = sym_new_not_null(ctx));
if (oparg & 1) {
OUT_OF_SPACE_IF_NULL(self_or_null = sym_new_unknown(ctx));
}
}

op(_LOAD_ATTR_MODULE, (index/1, owner -- attr, null if (oparg & 1))) {
(void)index;
OUT_OF_SPACE_IF_NULL(null = sym_new_null(ctx));
Expand Down Expand Up @@ -513,7 +521,6 @@ dummy_func(void) {
OUT_OF_SPACE_IF_NULL(self = sym_new_not_null(ctx));
}


op(_CHECK_FUNCTION_EXACT_ARGS, (func_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
if (!sym_set_type(callable, &PyFunction_Type)) {
goto hit_bottom;
Expand Down
Loading

0 comments on commit 617aca9

Please sign in to comment.