Core and Builtins
-----------------
+- Issue #15895: Fix FILE pointer leak in PyRun_SimpleFileExFlags() when
+ filename points to a pyc/pyo file and closeit is false.
+
- Issue #15900: Fix reference leak in PyUnicode_TranslateCharmap().
- Issue #15839: Convert SystemErrors in super() to RuntimeErrors.
{
PyObject *m, *d, *v;
const char *ext;
- int set_file_name = 0, ret;
+ int set_file_name = 0, close_own_fp = 0, ret;
size_t len;
m = PyImport_AddModule("__main__");
ret = -1;
goto done;
}
+ close_own_fp = 1;
/* Turn on optimization if a .pyo file is given */
if (strcmp(ext, ".pyo") == 0)
Py_OptimizeFlag = 1;
Py_DECREF(v);
ret = 0;
done:
+ if (close_own_fp) {
+ fclose(fp);
+ }
if (set_file_name && PyDict_DelItemString(d, "__file__"))
PyErr_Clear();
return ret;