Skip to content

Commit a548f37

Browse files
committed
Address review
1 parent ae5a942 commit a548f37

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Doc/c-api/init.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ 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`
4544
* the configuration functions covered in :ref:`init-config`
4645

4746
* Informative functions:

Lib/test/test_embed.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,9 +315,9 @@ def test_pre_initialization_sys_options(self):
315315
print(out)
316316
print(err)
317317
expected_output = (
318-
"sys.warnoptions: ['default', 'once', 'module']\n"
318+
"sys.warnoptions: ['once', 'module', 'default']\n"
319319
"sys._xoptions: {'not_an_option': '1', 'also_not_an_option': '2'}\n"
320-
"warnings.filters[:3]: ['module', 'once', 'default']\n"
320+
"warnings.filters[:3]: ['default', 'module', 'once']\n"
321321
)
322322
self.assertIn(expected_output, out)
323323
self.assertEqual(err, '')

Programs/_testembed.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ extern void PySys_AddWarnOption(const wchar_t *s);
2222
extern void PySys_AddXOption(const wchar_t *s);
2323
extern void Py_SetPath(const wchar_t *path);
2424

25+
// These functions were removed from Python 3.15 API but are still exported
26+
// for the stable ABI. We want to test them in this program.
27+
extern void PySys_ResetWarnOptions(void);
28+
2529

2630
int main_argc;
2731
char **main_argv;
@@ -343,9 +347,12 @@ static int test_pre_initialization_sys_options(void)
343347

344348
_Py_EMBED_PREINIT_CHECK("Checking PySys_AddWarnOption\n");
345349
PySys_AddWarnOption(L"default");
350+
_Py_EMBED_PREINIT_CHECK("Checking PySys_ResetWarnOptions\n");
351+
PySys_ResetWarnOptions();
346352
_Py_EMBED_PREINIT_CHECK("Checking PySys_AddWarnOption linked list\n");
347353
PySys_AddWarnOption(dynamic_once_warnoption);
348354
PySys_AddWarnOption(L"module");
355+
PySys_AddWarnOption(L"default");
349356
_Py_EMBED_PREINIT_CHECK("Checking PySys_AddXOption\n");
350357
PySys_AddXOption(L"not_an_option=1");
351358
PySys_AddXOption(dynamic_xoption);

0 commit comments

Comments
 (0)