diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-10-10 10:55:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 10:55:21 (GMT) |
commit | c1e8e90915e38604175e20e36a24fe45249cdc33 (patch) | |
tree | 4c9afd5aadf26c4887092ce7be9825a8c3e3a252 /Lib | |
parent | 55d607683f85367e503ee34b85bc3b9c1a782552 (diff) | |
download | cpython-c1e8e90915e38604175e20e36a24fe45249cdc33.zip cpython-c1e8e90915e38604175e20e36a24fe45249cdc33.tar.gz cpython-c1e8e90915e38604175e20e36a24fe45249cdc33.tar.bz2 |
[3.12] gh-110590: Fix a bug where _sre.compile would overwrite exceptions (GH-110591) (#110613)
TypeError would be overwritten by OverflowError
if 'code' param contained non-ints.
(cherry picked from commit 344d3a222a7864f8157773749bdd77d1c9dfc1e6)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Lib')
-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 5a5de52..382ef0b 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -2694,6 +2694,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): |