summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_re.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_re.py')
-rw-r--r--Lib/test/test_re.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py
index 11628a2..a05a1c9 100644
--- a/Lib/test/test_re.py
+++ b/Lib/test/test_re.py
@@ -2441,6 +2441,16 @@ class ReTests(unittest.TestCase):
p.terminate()
p.join()
+ def test_sre_template_invalid_group_index(self):
+ # see gh-106524
+ import _sre
+ with self.assertRaises(TypeError) as cm:
+ _sre.template("", ["", -1, ""])
+ self.assertIn("invalid template", str(cm.exception))
+ with self.assertRaises(TypeError) as cm:
+ _sre.template("", ["", (), ""])
+ self.assertIn("an integer is required", str(cm.exception))
+
def get_debug_out(pat):
with captured_stdout() as out: