Skip to content

Commit 41f8010

Browse files
committed
gh-160814: Add test for IN with skip < 2 in the SRE validator
1 parent 46264c1 commit 41f8010

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎Lib/test/test_re.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3263,6 +3263,14 @@ def test_sre_template_invalid_group_index(self):
32633263
_sre.template("", ["", (), ""])
32643264
self.assertIn("an integer is required", str(cm.exception))
32653265

3266+
@cpython_only
3267+
def test_sre_IN_invalid_skip(self):
3268+
# gh-160814: the validator must reject the IN opcode with skip < 2.
3269+
import _sre
3270+
for skip in (0, 1):
3271+
with self.assertRaises(RuntimeError):
3272+
_sre.compile("x", 0, [13, skip, 1], 0, {}, ())
3273+
32663274

32673275
class ExternalTests(unittest.TestCase):
32683276

0 commit comments

Comments
 (0)