Skip to content

Commit 4ed7d1d

Browse files
authored
GH-123996: Explicitly mark 'self_or_null' as an array of size 1 to ensure that it is kept in memory for calls (GH-124003)
1 parent 3ea51fa commit 4ed7d1d

File tree

7 files changed

+344
-327
lines changed

7 files changed

+344
-327
lines changed

Lib/test/test_generated_cases.py

+38
Original file line numberDiff line numberDiff line change
@@ -1110,6 +1110,44 @@ def test_push_then_error(self):
11101110
"""
11111111
self.run_cases_test(input, output)
11121112

1113+
def test_scalar_array_inconsistency(self):
1114+
1115+
input = """
1116+
op(FIRST, ( -- a)) {
1117+
a = 1;
1118+
}
1119+
1120+
op(SECOND, (a[1] -- b)) {
1121+
b = 1;
1122+
}
1123+
1124+
macro(TEST) = FIRST + SECOND;
1125+
"""
1126+
1127+
output = """
1128+
"""
1129+
with self.assertRaises(SyntaxError):
1130+
self.run_cases_test(input, output)
1131+
1132+
def test_array_size_inconsistency(self):
1133+
1134+
input = """
1135+
op(FIRST, ( -- a[2])) {
1136+
a[0] = 1;
1137+
}
1138+
1139+
op(SECOND, (a[1] -- b)) {
1140+
b = 1;
1141+
}
1142+
1143+
macro(TEST) = FIRST + SECOND;
1144+
"""
1145+
1146+
output = """
1147+
"""
1148+
with self.assertRaises(SyntaxError):
1149+
self.run_cases_test(input, output)
1150+
11131151

11141152
class TestGeneratedAbstractCases(unittest.TestCase):
11151153
def setUp(self) -> None:

Python/bytecodes.c

+67-76
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)