diff options
-rw-r--r-- | Lib/test/test_re.py | 1 | ||||
-rw-r--r-- | Modules/_sre.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_re.py b/Lib/test/test_re.py index 1626c80b95..99cc47ba3a 100644 --- a/Lib/test/test_re.py +++ b/Lib/test/test_re.py @@ -706,6 +706,7 @@ class ReTests(unittest.TestCase): long_overflow = 2**128 self.assertRaises(TypeError, re.finditer, "a", {}) self.assertRaises(OverflowError, _sre.compile, "abc", 0, [long_overflow]) + self.assertRaises(TypeError, _sre.compile, {}, 0, []) def run_re_tests(): from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR diff --git a/Modules/_sre.c b/Modules/_sre.c index 74d942568f..ee6a26bb40 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -2702,7 +2702,7 @@ _compile(PyObject* self_, PyObject* args) else { Py_ssize_t p_length; if (!getstring(pattern, &p_length, &self->charsize)) { - PyObject_DEL(self); + Py_DECREF(self); return NULL; } } |