[3.14] gh-139748: fix leaks in AC error paths when using unicode FS-b… (#139789)

* [3.14] gh-139748: fix leaks in AC error paths when using unicode FS-based converters (GH-139765)
(cherry picked from commit b04a57deef)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
Kumar Aditya 2025-10-08 22:16:21 +05:30 committed by GitHub
parent 077652b44f
commit 90cd009209
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 88 additions and 46 deletions

View file

@ -745,7 +745,7 @@ builtin_chr(PyObject *module, PyObject *i)
compile as builtin_compile
source: object
filename: object(converter="PyUnicode_FSDecoder")
filename: unicode_fs_decoded
mode: str
flags: int = 0
dont_inherit: bool = False
@ -771,7 +771,7 @@ static PyObject *
builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
const char *mode, int flags, int dont_inherit,
int optimize, int feature_version)
/*[clinic end generated code: output=b0c09c84f116d3d7 input=cc78e20e7c7682ba]*/
/*[clinic end generated code: output=b0c09c84f116d3d7 input=8f0069edbdac381b]*/
{
PyObject *source_copy;
const char *str;
@ -889,7 +889,6 @@ builtin_compile_impl(PyObject *module, PyObject *source, PyObject *filename,
error:
result = NULL;
finally:
Py_DECREF(filename);
return result;
}