mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
gh-120244: Fix re.sub() reference leak (GH-120245)
This commit is contained in:
parent
55402d3232
commit
38a25e9560
2 changed files with 2 additions and 0 deletions
|
@ -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);
|
self->items[i].literal = Py_XNewRef(literal);
|
||||||
}
|
}
|
||||||
|
PyObject_GC_Track(self);
|
||||||
return (PyObject*) self;
|
return (PyObject*) self;
|
||||||
|
|
||||||
bad_template:
|
bad_template:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue