Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5abeafb

Browse files
author
Victor Stinner
committed
Issue #3299: replace PyObject_DEL() by Py_DECREF() in _sre module to fix a
crash in pydebug mode.
1 parent f0cbd82 commit 5abeafb

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/test/test_re.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,7 @@ def test_dealloc(self):
727727
long_overflow = 2**128
728728
self.assertRaises(TypeError, re.finditer, "a", {})
729729
self.assertRaises(OverflowError, _sre.compile, "abc", 0, [long_overflow])
730+
self.assertRaises(TypeError, _sre.compile, {}, 0, [])
730731

731732
def run_re_tests():
732733
from test.re_tests import benchmarks, tests, SUCCEED, FAIL, SYNTAX_ERROR

Modules/_sre.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2702,7 +2702,7 @@ _compile(PyObject* self_, PyObject* args)
27022702
else {
27032703
Py_ssize_t p_length;
27042704
if (!getstring(pattern, &p_length, &self->charsize)) {
2705-
PyObject_DEL(self);
2705+
Py_DECREF(self);
27062706
return NULL;
27072707
}
27082708
}

0 commit comments

Comments
 (0)