update
This commit is contained in:
63
.CondaPkg/env/include/internal/pycore_interp.h
vendored
63
.CondaPkg/env/include/internal/pycore_interp.h
vendored
@@ -39,6 +39,32 @@ struct _Py_long_state {
|
||||
int max_str_digits;
|
||||
};
|
||||
|
||||
|
||||
/* cross-interpreter data registry */
|
||||
|
||||
/* For now we use a global registry of shareable classes. An
|
||||
alternative would be to add a tp_* slot for a class's
|
||||
crossinterpdatafunc. It would be simpler and more efficient. */
|
||||
|
||||
struct _xidregitem;
|
||||
|
||||
struct _xidregitem {
|
||||
struct _xidregitem *prev;
|
||||
struct _xidregitem *next;
|
||||
/* This can be a dangling pointer, but only if weakref is set. */
|
||||
PyTypeObject *cls;
|
||||
/* This is NULL for builtin types. */
|
||||
PyObject *weakref;
|
||||
size_t refcount;
|
||||
crossinterpdatafunc getdata;
|
||||
};
|
||||
|
||||
struct _xidregistry {
|
||||
PyThread_type_lock mutex;
|
||||
struct _xidregitem *head;
|
||||
};
|
||||
|
||||
|
||||
/* interpreter state */
|
||||
|
||||
/* PyInterpreterState holds the global state for one of the runtime's
|
||||
@@ -194,6 +220,14 @@ struct _is {
|
||||
struct _Py_interp_cached_objects cached_objects;
|
||||
struct _Py_interp_static_objects static_objects;
|
||||
|
||||
// XXX Remove this field once we have a tp_* slot.
|
||||
struct _xidregistry xidregistry;
|
||||
/* The thread currently executing in the __main__ module, if any. */
|
||||
PyThreadState *threads_main;
|
||||
/* The ID of the OS thread in which we are finalizing.
|
||||
We use _Py_atomic_address instead of adding a new _Py_atomic_ulong. */
|
||||
_Py_atomic_address _finalizing_id;
|
||||
|
||||
/* the initial PyInterpreterState.threads.head */
|
||||
PyThreadState _initial_thread;
|
||||
};
|
||||
@@ -209,27 +243,26 @@ _PyInterpreterState_GetFinalizing(PyInterpreterState *interp) {
|
||||
return (PyThreadState*)_Py_atomic_load_relaxed(&interp->_finalizing);
|
||||
}
|
||||
|
||||
static inline unsigned long
|
||||
_PyInterpreterState_GetFinalizingID(PyInterpreterState *interp) {
|
||||
return (unsigned long)_Py_atomic_load_relaxed(&interp->_finalizing_id);
|
||||
}
|
||||
|
||||
static inline void
|
||||
_PyInterpreterState_SetFinalizing(PyInterpreterState *interp, PyThreadState *tstate) {
|
||||
_Py_atomic_store_relaxed(&interp->_finalizing, (uintptr_t)tstate);
|
||||
if (tstate == NULL) {
|
||||
_Py_atomic_store_relaxed(&interp->_finalizing_id, 0);
|
||||
}
|
||||
else {
|
||||
// XXX Re-enable this assert once gh-109860 is fixed.
|
||||
//assert(tstate->thread_id == PyThread_get_thread_ident());
|
||||
_Py_atomic_store_relaxed(&interp->_finalizing_id,
|
||||
(uintptr_t)tstate->thread_id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* cross-interpreter data registry */
|
||||
|
||||
/* For now we use a global registry of shareable classes. An
|
||||
alternative would be to add a tp_* slot for a class's
|
||||
crossinterpdatafunc. It would be simpler and more efficient. */
|
||||
|
||||
struct _xidregitem;
|
||||
|
||||
struct _xidregitem {
|
||||
struct _xidregitem *prev;
|
||||
struct _xidregitem *next;
|
||||
PyObject *cls; // weakref to a PyTypeObject
|
||||
crossinterpdatafunc getdata;
|
||||
};
|
||||
|
||||
PyAPI_FUNC(PyInterpreterState*) _PyInterpreterState_LookUpID(int64_t);
|
||||
|
||||
PyAPI_FUNC(int) _PyInterpreterState_IDInitref(PyInterpreterState *);
|
||||
|
||||
Reference in New Issue
Block a user