Skip to content

Commit 1d1e7f4

Browse files
committed
Keep _Py_fopen_obj() function
1 parent e6a53fe commit 1d1e7f4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Include/cpython/fileutils.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,9 @@ PyAPI_FUNC(FILE*) Py_fopen(
66
PyObject *path,
77
const char *mode);
88

9+
// Deprecated alias to Py_fopen() kept for backward compatibility
10+
Py_DEPRECATED(3.14) PyAPI_FUNC(FILE*) _Py_fopen_obj(
11+
PyObject *path,
12+
const char *mode);
13+
914
PyAPI_FUNC(int) Py_fclose(FILE *file);

Python/fileutils.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,6 +1843,14 @@ Py_fopen(PyObject *path, const char *mode)
18431843
}
18441844

18451845

1846+
// Deprecated alias to Py_fopen() kept for backward compatibility
1847+
FILE*
1848+
_Py_fopen_obj(PyObject *path, const char *mode)
1849+
{
1850+
return Py_fopen(path, mode);
1851+
}
1852+
1853+
18461854
// Call fclose().
18471855
//
18481856
// On Windows, files opened by Py_fopen() in the Python DLL must be closed by

0 commit comments

Comments
 (0)