Core and Builtins
-----------------
+- Issue #14505: Fix file descriptor leak when deallocating file objects
+ created with PyFile_FromString().
+
- Issue #14474: Save and restore exception state in thread.start_new_thread()
while writing error message if the thread leaves a unhandled exception.
PyObject *
PyFile_FromString(char *name, char *mode)
{
+ extern int fclose(FILE *);
PyFileObject *f;
- f = (PyFileObject *)PyFile_FromFile((FILE *)NULL, name, mode, NULL);
+ f = (PyFileObject *)PyFile_FromFile((FILE *)NULL, name, mode, fclose);
if (f != NULL) {
if (open_the_file(f, name, mode) == NULL) {
Py_DECREF(f);