File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff 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:
Original file line number Diff line number Diff 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 , '' )
Original file line number Diff line number Diff line change @@ -22,6 +22,10 @@ extern void PySys_AddWarnOption(const wchar_t *s);
2222extern void PySys_AddXOption (const wchar_t * s );
2323extern 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
2630int main_argc ;
2731char * * 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 );
You can’t perform that action at this time.
0 commit comments