Commit 5abeafbb authored by Victor Stinner's avatar Victor Stinner

Issue #3299: replace PyObject_DEL() by Py_DECREF() in _sre module to fix a

crash in pydebug mode.
parent f0cbd821
...@@ -727,6 +727,7 @@ class ReTests(unittest.TestCase): ...@@ -727,6 +727,7 @@ class ReTests(unittest.TestCase):
long_overflow = 2**128 long_overflow = 2**128
self.assertRaises(TypeError, re.finditer, "a", {}) self.assertRaises(TypeError, re.finditer, "a", {})
self.assertRaises(OverflowError, _sre.compile, "abc", 0, [long_overflow]) self.assertRaises(OverflowError, _sre.compile, "abc", 0, [long_overflow])
self.assertRaises(TypeError, _sre.compile, {}, 0, [])
def run_re_tests(): def run_re_tests():
from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR
......
...@@ -2702,7 +2702,7 @@ _compile(PyObject* self_, PyObject* args) ...@@ -2702,7 +2702,7 @@ _compile(PyObject* self_, PyObject* args)
else { else {
Py_ssize_t p_length; Py_ssize_t p_length;
if (!getstring(pattern, &p_length, &self->charsize)) { if (!getstring(pattern, &p_length, &self->charsize)) {
PyObject_DEL(self); Py_DECREF(self);
return NULL; return NULL;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment