gh-139748: fix leaks in AC error paths when using unicode FS-based converters (#139765)

This commit is contained in:
Bénédikt Tran 2025-10-08 17:22:44 +02:00 committed by GitHub
parent 570d17259f
commit b04a57deef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 88 additions and 46 deletions

View file

@ -13,7 +13,7 @@ module _symtable
_symtable.symtable
source: object
filename: object(converter='PyUnicode_FSDecoder')
filename: unicode_fs_decoded
startstr: str
/
@ -23,7 +23,7 @@ Return symbol and scope dictionaries used internally by compiler.
static PyObject *
_symtable_symtable_impl(PyObject *module, PyObject *source,
PyObject *filename, const char *startstr)
/*[clinic end generated code: output=59eb0d5fc7285ac4 input=9dd8a50c0c36a4d7]*/
/*[clinic end generated code: output=59eb0d5fc7285ac4 input=436ffff90d02e4f6]*/
{
struct symtable *st;
PyObject *t;
@ -47,12 +47,10 @@ _symtable_symtable_impl(PyObject *module, PyObject *source,
else {
PyErr_SetString(PyExc_ValueError,
"symtable() arg 3 must be 'exec' or 'eval' or 'single'");
Py_DECREF(filename);
Py_XDECREF(source_copy);
return NULL;
}
st = _Py_SymtableStringObjectFlags(str, filename, start, &cf);
Py_DECREF(filename);
Py_XDECREF(source_copy);
if (st == NULL) {
return NULL;