diff options
author | Nikita Sobolev <mail@sobolevn.me> | 2023-10-10 10:15:12 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 10:15:12 (GMT) |
commit | 344d3a222a7864f8157773749bdd77d1c9dfc1e6 (patch) | |
tree | df48ad12a6ebd272c12be11e7463966098ad4c48 /Lib/test | |
parent | 0362cbf908aff2b87298f8a9422e7b368f890071 (diff) | |
download | cpython-344d3a222a7864f8157773749bdd77d1c9dfc1e6.zip cpython-344d3a222a7864f8157773749bdd77d1c9dfc1e6.tar.gz cpython-344d3a222a7864f8157773749bdd77d1c9dfc1e6.tar.bz2 |
gh-110590: Fix a bug where _sre.compile would overwrite exceptions (#110591)
TypeError would be overwritten by OverflowError
if 'code' param contained non-ints.
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_re.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 45bce19..301d4a5 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -2735,6 +2735,9 @@ class ImplementationTest(unittest.TestCase): _sre.compile("abc", 0, [long_overflow], 0, {}, ()) with self.assertRaises(TypeError): _sre.compile({}, 0, [], 0, [], []) + # gh-110590: `TypeError` was overwritten with `OverflowError`: + with self.assertRaises(TypeError): + _sre.compile('', 0, ['abc'], 0, {}, ()) @cpython_only def test_repeat_minmax_overflow_maxrepeat(self): |