Skip to content

gh-76785: Improved Subinterpreters Compatibility with 3.12 #115424

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
merged 20 commits into from
Feb 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
Add _PyRuntimeState_GetXIState() and _PyInterpreterState_GetXIState().
  • Loading branch information
ericsnowcurrently committed Feb 13, 2024
commit 00b80ff60dc65e246f794ebe6d33d7757bf3227f
3 changes: 3 additions & 0 deletions Include/internal/pycore_crossinterp.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ extern void _PyXI_Fini(PyInterpreterState *interp);
extern PyStatus _PyXI_InitTypes(PyInterpreterState *interp);
extern void _PyXI_FiniTypes(PyInterpreterState *interp);

#define _PyRuntimeState_GetXIState(runtime) (&(runtime)->xi)
#define _PyInterpreterState_GetXIState(interp) (&(interp)->xi)


/***************************/
/* short-term data sharing */
Expand Down
12 changes: 6 additions & 6 deletions Python/crossinterp.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,21 +128,21 @@ _init_not_shareable_error_type(PyInterpreterState *interp)
return _PyStatus_ERR("could not initialize NotShareableError");
}

interp->xi.PyExc_NotShareableError = exctype;
_PyInterpreterState_GetXIState(interp)->PyExc_NotShareableError = exctype;
return _PyStatus_OK();
}

static void
_fini_not_shareable_error_type(PyInterpreterState *interp)
{
Py_CLEAR(interp->xi.PyExc_NotShareableError);
Py_CLEAR(_PyInterpreterState_GetXIState(interp)->PyExc_NotShareableError);
}

static PyObject *
_get_not_shareable_error_type(PyInterpreterState *interp)
{
assert(interp->xi.PyExc_NotShareableError != NULL);
return interp->xi.PyExc_NotShareableError;
assert(_PyInterpreterState_GetXIState(interp)->PyExc_NotShareableError != NULL);
return _PyInterpreterState_GetXIState(interp)->PyExc_NotShareableError;
}


Expand Down Expand Up @@ -420,13 +420,13 @@ _PyCrossInterpreterData_ReleaseAndRawFree(_PyCrossInterpreterData *data)
static inline struct _xidregistry *
_get_global_xidregistry(_PyRuntimeState *runtime)
{
return &runtime->xi.registry;
return &_PyRuntimeState_GetXIState(runtime)->registry;
}

static inline struct _xidregistry *
_get_xidregistry(PyInterpreterState *interp)
{
return &interp->xi.registry;
return &_PyInterpreterState_GetXIState(interp)->registry;
}

static inline struct _xidregistry *
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy