Skip to content

Commit 3d0a94f

Browse files
committed
gh-138886: Remove deprecated PySys_ResetWarnOptions C-API function
1 parent 7168e98 commit 3d0a94f

File tree

10 files changed

+10
-17
lines changed

10 files changed

+10
-17
lines changed

Doc/c-api/init.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ The following functions can be safely called before Python is initialized:
4141
* :c:func:`PyObject_SetArenaAllocator`
4242
* :c:func:`Py_SetProgramName`
4343
* :c:func:`Py_SetPythonHome`
44-
* :c:func:`PySys_ResetWarnOptions`
44+
* :c:func:`!PySys_ResetWarnOptions`
4545
* the configuration functions covered in :ref:`init-config`
4646

4747
* Informative functions:

Doc/c-api/sys.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -316,14 +316,6 @@ accessible to C code. They all work with the current interpreter thread's
316316
case *name* is deleted from the sys module. Returns ``0`` on success, ``-1``
317317
on error.
318318
319-
.. c:function:: void PySys_ResetWarnOptions()
320-
321-
Reset :data:`sys.warnoptions` to an empty list. This function may be
322-
called prior to :c:func:`Py_Initialize`.
323-
324-
.. deprecated-removed:: 3.13 3.15
325-
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
326-
327319
.. c:function:: void PySys_WriteStdout(const char *format, ...)
328320
329321
Write the output string described by *format* to :data:`sys.stdout`. No

Doc/data/stable_abi.dat

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Doc/whatsnew/3.13.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2490,7 +2490,7 @@ Deprecated C APIs
24902490

24912491
* Deprecate old Python initialization functions:
24922492

2493-
* :c:func:`PySys_ResetWarnOptions`:
2493+
* :c:func:`!PySys_ResetWarnOptions`:
24942494
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
24952495
* :c:func:`!Py_GetExecPrefix`:
24962496
Get :data:`sys.exec_prefix` instead.

Doc/whatsnew/3.15.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,11 @@ Removed C APIs
800800
of :c:func:`PyImport_ImportModule`.
801801
(Contributed by Bénédikt Tran in :gh:`133644`.)
802802

803+
* Remove deprecated :c:func:`!PySys_ResetWarnOptions`.
804+
Clear :data:`sys.warnoptions` and :data:`!warnings.filters` instead.
805+
806+
(Contributed by Nikita Sobolev in :gh:`138886`.)
807+
803808
The following functions are removed in favor of :c:func:`PyConfig_Get`.
804809
The |pythoncapi_compat_project| can be used to get :c:func:`!PyConfig_Get`
805810
on Python 3.13 and older.

Include/sysmodule.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...)
2323
PyAPI_FUNC(void) PySys_FormatStdout(const char *format, ...);
2424
PyAPI_FUNC(void) PySys_FormatStderr(const char *format, ...);
2525

26-
Py_DEPRECATED(3.13) PyAPI_FUNC(void) PySys_ResetWarnOptions(void);
27-
2826
PyAPI_FUNC(PyObject *) PySys_GetXOptions(void);
2927

3028
#ifdef __cplusplus
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Remove deprecated :c:func:`PySys_ResetWarnOptions` C-API function.

Misc/stable_abi.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,6 +1335,7 @@
13351335
abi_only = true
13361336
[function.PySys_ResetWarnOptions]
13371337
added = '3.2'
1338+
abi_only = true
13381339
[function.PySys_SetArgv]
13391340
added = '3.2'
13401341
[function.PySys_SetArgvEx]

Programs/_testembed.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,12 +343,9 @@ static int test_pre_initialization_sys_options(void)
343343

344344
_Py_EMBED_PREINIT_CHECK("Checking PySys_AddWarnOption\n");
345345
PySys_AddWarnOption(L"default");
346-
_Py_EMBED_PREINIT_CHECK("Checking PySys_ResetWarnOptions\n");
347-
PySys_ResetWarnOptions();
348346
_Py_EMBED_PREINIT_CHECK("Checking PySys_AddWarnOption linked list\n");
349347
PySys_AddWarnOption(dynamic_once_warnoption);
350348
PySys_AddWarnOption(L"module");
351-
PySys_AddWarnOption(L"default");
352349
_Py_EMBED_PREINIT_CHECK("Checking PySys_AddXOption\n");
353350
PySys_AddXOption(L"not_an_option=1");
354351
PySys_AddXOption(dynamic_xoption);

Python/sysmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3045,7 +3045,7 @@ get_warnoptions(PyThreadState *tstate)
30453045
return warnoptions;
30463046
}
30473047

3048-
void
3048+
PyAPI_FUNC(void)
30493049
PySys_ResetWarnOptions(void)
30503050
{
30513051
PyThreadState *tstate = _PyThreadState_GET();

0 commit comments

Comments
 (0)