mirror of https://github.com/python/cpython
[3.13] gh-120244: Fix re.sub() reference leak (GH-120245) (GH-120264)
(cherry picked from commit 38a25e9560
)
Co-authored-by: neonene <53406459+neonene@users.noreply.github.com>
This commit is contained in:
parent
863a0bd515
commit
9b704ceeca
|
@ -0,0 +1 @@
|
|||
Fix memory leak in :func:`re.sub()` when the replacement string contains backreferences.
|
|
@ -1622,6 +1622,7 @@ _sre_template_impl(PyObject *module, PyObject *pattern, PyObject *template)
|
|||
}
|
||||
self->items[i].literal = Py_XNewRef(literal);
|
||||
}
|
||||
PyObject_GC_Track(self);
|
||||
return (PyObject*) self;
|
||||
|
||||
bad_template:
|
||||
|
|
Loading…
Reference in New Issue