Skip to content

Commit

Permalink
GH-123996: Explicitly mark 'self_or_null' as an array of size 1 to en…
Browse files Browse the repository at this point in the history
…sure that it is kept in memory for calls (GH-124003)
  • Loading branch information
markshannon committed Sep 12, 2024
1 parent 3ea51fa commit 4ed7d1d
Show file tree
Hide file tree
Showing 7 changed files with 344 additions and 327 deletions.
38 changes: 38 additions & 0 deletions Lib/test/test_generated_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,44 @@ def test_push_then_error(self):
"""
self.run_cases_test(input, output)

def test_scalar_array_inconsistency(self):

input = """
op(FIRST, ( -- a)) {
a = 1;
}
op(SECOND, (a[1] -- b)) {
b = 1;
}
macro(TEST) = FIRST + SECOND;
"""

output = """
"""
with self.assertRaises(SyntaxError):
self.run_cases_test(input, output)

def test_array_size_inconsistency(self):

input = """
op(FIRST, ( -- a[2])) {
a[0] = 1;
}
op(SECOND, (a[1] -- b)) {
b = 1;
}
macro(TEST) = FIRST + SECOND;
"""

output = """
"""
with self.assertRaises(SyntaxError):
self.run_cases_test(input, output)


class TestGeneratedAbstractCases(unittest.TestCase):
def setUp(self) -> None:
Expand Down
143 changes: 67 additions & 76 deletions Python/bytecodes.c

Large diffs are not rendered by default.

Loading

0 comments on commit 4ed7d1d

Please sign in to comment.