Skip to content

Commit 0b72907

Browse files
authored
gh-154757: No longer deprecate PyModule_GetFilename() (#158076)
1 parent 7242fea commit 0b72907

5 files changed

Lines changed: 10 additions & 6 deletions

File tree

‎Doc/c-api/module.rst‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ Module Objects
128128
The returned buffer is only valid until the module's :py:attr:`~module.__file__` attribute
129129
is reassigned or the module is destroyed.
130130
131-
.. deprecated:: 3.2
132-
:c:func:`PyModule_GetFilename` raises :exc:`UnicodeEncodeError` on
133-
unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead.
131+
:c:func:`PyModule_GetFilename` raises :exc:`UnicodeEncodeError` on
132+
unencodable filenames, use :c:func:`PyModule_GetFilenameObject` instead.
134133
135134
136135
.. _c_module_slots:

‎Doc/deprecations/c-api-pending-removal-in-future.rst‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ although there is currently no date scheduled for their removal.
1212
Use :c:func:`PyErr_GetRaisedException` instead.
1313
* :c:func:`PyErr_Restore`:
1414
Use :c:func:`PyErr_SetRaisedException` instead.
15-
* :c:func:`PyModule_GetFilename`:
16-
Use :c:func:`PyModule_GetFilenameObject` instead.
1715
* :c:func:`PyOS_AfterFork`:
1816
Use :c:func:`PyOS_AfterFork_Child` instead.
1917
* :c:func:`PySlice_GetIndicesEx`:

‎Doc/whatsnew/3.16.rst‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,10 @@ Deprecated C APIs
11281128
and :c:func:`PyAsyncGen_New` are deprecated.
11291129
They are scheduled for removal in 3.18.
11301130

1131+
* :c:func:`PyModule_GetFilename` is no longer deprecated, but using
1132+
:c:func:`PyModule_GetFilenameObject` instead is still recommended.
1133+
(Contributed by Victor Stinner in :gh:`154757`.)
1134+
11311135
.. Add C API deprecations above alphabetically, not here at the end.
11321136
11331137
.. include:: ../deprecations/c-api-pending-removal-in-3.18.rst

‎Include/moduleobject.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *);
2525
PyAPI_FUNC(PyObject *) PyModule_GetNameObject(PyObject *);
2626
#endif
2727
PyAPI_FUNC(const char *) PyModule_GetName(PyObject *);
28-
Py_DEPRECATED(3.2) PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
28+
PyAPI_FUNC(const char *) PyModule_GetFilename(PyObject *);
2929
PyAPI_FUNC(PyObject *) PyModule_GetFilenameObject(PyObject *);
3030
PyAPI_FUNC(PyModuleDef*) PyModule_GetDef(PyObject*);
3131
PyAPI_FUNC(void*) PyModule_GetState(PyObject*);
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:c:func:`PyModule_GetFilename` is no longer deprecated, but using
2+
:c:func:`PyModule_GetFilenameObject` instead is still recommended. Patch by
3+
Victor Stinner.

0 commit comments

Comments
 (0)