10000 gh-101524: Only Use Public C-API in the _xxsubinterpreters Module by ericsnowcurrently · Pull Request #107359 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-101524: Only Use Public C-API in the _xxsubinterpreters Module #107359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Restore PyUnstable_AtExit() to the public API.
  • Loading branch information
ericsnowcurrently committed Jul 27, 2023
commit 40f4d3da213fa2cea51b97c3b4e5304b6f522860
4 changes: 4 additions & 0 deletions Include/cpython/pylifecycle.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,7 @@ typedef struct {
PyAPI_FUNC(PyStatus) Py_NewInterpreterFromConfig(
PyThreadState **tstate_p,
const PyInterpreterConfig *config);

typedef void (*atexit_datacallbackfunc)(void *);
PyAPI 10000 _FUNC(int) PyUnstable_AtExit(
PyInterpreterState *, atexit_datacallbackfunc, void *);
2 changes: 1 addition & 1 deletion Modules/_testinternalcapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1433,7 +1433,7 @@ test_atexit(PyObject *self, PyObject *Py_UNUSED(args))
PyThreadState *tstate = Py_NewInterpreter();

struct atexit_data data = {0};
int res = _Py_AtExit(tstate->interp, callback, (void *)&data);
int res = PyUnstable_AtExit(tstate->interp, callback, (void *)&data);
Py_EndInterpreter(tstate);
PyThreadState_Swap(oldts);
if (res < 0) {
Expand Down
3 changes: 1 addition & 2 deletions Modules/_xxinterpchannelsmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#endif

#include "Python.h"
#include "pycore_atexit.h" // _Py_AtExit()
#include "pycore_interp_id.h" // _PyInterpreterState_GetIDObject()


Expand Down Expand Up @@ -2407,7 +2406,7 @@ module_exec(PyObject *mod)

// Make sure chnnels drop objects owned by this interpreter
PyInterpreterState *interp = _get_current_interp();
_Py_AtExit(interp, clear_interpreter, (void *)interp);
PyUnstable_AtExit(interp, clear_interpreter, (void *)interp);

return 0;

Expand Down
4 changes: 2 additions & 2 deletions Modules/atexitmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ get_atexit_state(void)


int
_Py_AtExit(PyInterpreterState *interp,
atexit_datacallbackfunc func, void *data)
PyUnstable_AtExit(PyInterpreterState *interp,
atexit_datacallbackfunc func, void *data)
{
assert(interp == _PyInterpreterState_GET());
atexit_callback *callback = PyMem_Malloc(sizeof(atexit_callback));
Expand Down
0