Skip to content
Open
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4e8a976
Add the option to not reuse the initial tstate.
ericsnowcurrently Jun 20, 2024
120c2a6
Add a test to verify the initial "main" tstate isn't special.
ericsnowcurrently Jun 20, 2024
608139b
Add tests to check different "bad" runtime fini situations.
ericsnowcurrently Jun 20, 2024
592b214
Fix the code in test_audit_subinterpreter.
ericsnowcurrently Jun 20, 2024
e6f31ff
Always try reusing the main tstate (and drop interp.reuse_init_tstate).
ericsnowcurrently Jun 21, 2024
05c0cf3
Skip test_fini_in_subthread on Windows.
ericsnowcurrently Jun 25, 2024
8b241d2
Expect a failure on Windows.
ericsnowcurrently Jun 25, 2024
b66c2b7
Fail if PyFinalize() fails.
ericsnowcurrently Jun 25, 2024
88b1679
Add _Py_Finalize() and struct pyfinalize_args.
ericsnowcurrently Jun 20, 2024
d9d0e10
Use _Py_Finalize() in the new tests.
ericsnowcurrently Jun 21, 2024
72e961f
Factor out resolve_final_tstate().
ericsnowcurrently Jun 25, 2024
e2392c2
Fix the Windows returncode.
ericsnowcurrently Jun 25, 2024
6b1eb57
Export _Py_Finalize().
ericsnowcurrently Jun 25, 2024
7b2afb6
Do not print the error messages with Py_Exit().
ericsnowcurrently Jun 25, 2024
155dddc
Rename the macro.
ericsnowcurrently Jun 25, 2024
f37bcc7
Fix the macro.
ericsnowcurrently Jun 25, 2024
0cffd32
Merge branch 'main' into tests-runtime-lifecycle-bad-usage
ericsnowcurrently Jun 26, 2024
361d477
Fix tests.
ericsnowcurrently Jun 26, 2024
d3beea4
Tweaks to resolve_final_tstate().
ericsnowcurrently Jun 27, 2024
d78f655
Fix the test failures.
ericsnowcurrently Jun 27, 2024
e5c5a5f
More tweaking resolve_final_tstate().
ericsnowcurrently Jun 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fail if PyFinalize() fails.
  • Loading branch information
ericsnowcurrently committed Jun 25, 2024
commit b66c2b774a736db229f834068a8c08dc4e9c5b86
17 changes: 8 additions & 9 deletions Programs/_testembed.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ static int test_replace_main_tstate(void)
}

assert(PyThreadState_Get() == tstate);
Py_Finalize();
if (Py_FinalizeEx() != 0) {
err = 1;
}

return err;
}
Expand All @@ -295,6 +297,7 @@ struct fini_subthread_args {
PyThreadState *main_tstate;
PyInterpreterState *interp;
PyMutex done;
int rc;
};

static void fini_with_new_tstate(void *arg)
Expand All @@ -310,7 +313,7 @@ static void fini_with_new_tstate(void *arg)
(void)PyThreadState_Swap(tstate);

assert(PyThreadState_Get() != args->main_tstate);
Py_Finalize();
args->rc = Py_FinalizeEx();

PyMutex_Unlock(&args->done);
}
Expand All @@ -331,7 +334,7 @@ static int test_fini_in_subthread(void)
PyMutex_Lock(&args.done);
PyMutex_Unlock(&args.done);

return 0;
return args.rc;
}

static int test_fini_in_main_thread_with_other_tstate(void)
Expand All @@ -343,9 +346,7 @@ static int test_fini_in_main_thread_with_other_tstate(void)
(void)PyThreadState_Swap(tstate);

assert(PyThreadState_Get() != main_tstate);
Py_Finalize();

return 0;
return Py_FinalizeEx();
}

static int test_fini_in_main_thread_with_subinterpreter(void)
Expand All @@ -362,9 +363,7 @@ static int test_fini_in_main_thread_with_subinterpreter(void)

// The subinterpreter's tstate is still current.
assert(PyThreadState_Get() == substate);
Py_Finalize();

return 0;
return Py_FinalizeEx();
}


Expand Down