diff options
author | Mark Shannon <mark@hotpy.org> | 2024-09-12 15:32:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-12 15:32:45 +0100 |
commit | 4ed7d1d6acc22807bfb5983c98fd59f7cb5061db (patch) | |
tree | 1a8fa46bf3f86fda923747b80a500d160009d637 /Lib/test/test_generated_cases.py | |
parent | 3ea51fa2e33797c772af6eaf6ede76d2dc6082ba (diff) | |
download | cpython-4ed7d1d6acc22807bfb5983c98fd59f7cb5061db.tar.gz cpython-4ed7d1d6acc22807bfb5983c98fd59f7cb5061db.zip |
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)
Diffstat (limited to 'Lib/test/test_generated_cases.py')
-rw-r--r-- | Lib/test/test_generated_cases.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Lib/test/test_generated_cases.py b/Lib/test/test_generated_cases.py index 7f821810aea..5d20e3c30bc 100644 --- a/Lib/test/test_generated_cases.py +++ b/Lib/test/test_generated_cases.py @@ -1110,6 +1110,44 @@ class TestGeneratedCases(unittest.TestCase): """ 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: |