Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions Doc/c-api/sys.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
2 changes: 1 addition & 1 deletion Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions Python/fileutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Loading