diff --git a/Doc/c-api/sys.rst b/Doc/c-api/sys.rst index 21f5c813c5dcdd..b132988aeac875 100644 --- a/Doc/c-api/sys.rst +++ b/Doc/c-api/sys.rst @@ -240,11 +240,6 @@ Operating System Utilities Call ``fclose(file)``. - This function is needed on Windows: ``FILE*`` files opened by - :c:func:`Py_fopen` in the Python DLL must be closed by the Python DLL to use - the same C runtime version. Otherwise, calling ``fclose()`` directly can - cause undefined behavior. - .. versionadded:: next diff --git a/Doc/whatsnew/3.14.rst b/Doc/whatsnew/3.14.rst index c12dd3aa13f936..918d34b3ed40b6 100644 --- a/Doc/whatsnew/3.14.rst +++ b/Doc/whatsnew/3.14.rst @@ -1048,7 +1048,7 @@ New features * Add :c:func:`Py_fopen` function to open a file. Similar to the :c:func:`!fopen` function, but the *path* parameter is a Python object and an exception is set on error. Add also :c:func:`Py_fclose` function to close a - file, function needed for Windows support. + file. (Contributed by Victor Stinner in :gh:`127350`.) Porting to Python 3.14 diff --git a/Python/fileutils.c b/Python/fileutils.c index 7075e6a6938efe..a3f889cb8a65e7 100644 --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -1839,9 +1839,9 @@ Py_fopen(PyObject *path, const char *mode) // Call fclose(). // -// This function is needed on Windows: FILE* files opened by Py_fopen() in the -// Python DLL must be closed by the Python DLL to use the same C runtime -// version. Otherwise, calling fclose() directly can cause undefined behavior. +// On Windows, files opened by Py_fopen() in the Python DLL must be closed by +// the Python DLL to use the same C runtime version. Otherwise, calling +// fclose() directly can cause undefined behavior. int Py_fclose(FILE *file) {