Skip to content

Commit b18b775

Browse files
Fidget-Spinneradorilson
authored andcommitted
pythongh-115419: Change default sym to not_null (pythonGH-116562)
1 parent e8ca2d8 commit b18b775

File tree

4 files changed

+104
-94
lines changed

4 files changed

+104
-94
lines changed

Lib/test/test_generated_cases.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ def test_overridden_abstract_args(self):
908908
909909
case OP2: {
910910
_Py_UopsSymbol *out;
911-
out = sym_new_unknown(ctx);
911+
out = sym_new_not_null(ctx);
912912
if (out == NULL) goto out_of_space;
913913
stack_pointer[-1] = out;
914914
break;
@@ -933,7 +933,7 @@ def test_no_overridden_case(self):
933933
output = """
934934
case OP: {
935935
_Py_UopsSymbol *out;
936-
out = sym_new_unknown(ctx);
936+
out = sym_new_not_null(ctx);
937937
if (out == NULL) goto out_of_space;
938938
stack_pointer[-1] = out;
939939
break;

Python/optimizer_bytecodes.c

+8-1
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,14 @@ dummy_func(void) {
449449
}
450450
}
451451

452+
op(_LOAD_ATTR, (owner -- attr, self_or_null if (oparg & 1))) {
453+
(void)owner;
454+
OUT_OF_SPACE_IF_NULL(attr = sym_new_not_null(ctx));
455+
if (oparg & 1) {
456+
OUT_OF_SPACE_IF_NULL(self_or_null = sym_new_unknown(ctx));
457+
}
458+
}
459+
452460
op(_LOAD_ATTR_MODULE, (index/1, owner -- attr, null if (oparg & 1))) {
453461
(void)index;
454462
OUT_OF_SPACE_IF_NULL(null = sym_new_null(ctx));
@@ -513,7 +521,6 @@ dummy_func(void) {
513521
OUT_OF_SPACE_IF_NULL(self = sym_new_not_null(ctx));
514522
}
515523

516-
517524
op(_CHECK_FUNCTION_EXACT_ARGS, (func_version/2, callable, self_or_null, unused[oparg] -- callable, self_or_null, unused[oparg])) {
518525
if (!sym_set_type(callable, &PyFunction_Type)) {
519526
goto hit_bottom;

0 commit comments

Comments
 (0)