Skip to content

Commit 6bd0c47

Browse files
bpo-32604: Remove xid registry. (#6813)
Remove the interpreters testing helper (and xid registry).
1 parent 5c7e079 commit 6bd0c47

File tree

9 files changed

+5
-4219
lines changed

9 files changed

+5
-4219
lines changed

Include/internal/pystate.h

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -73,75 +73,6 @@ PyAPI_FUNC(int) _PyInterpreterState_IDInitref(PyInterpreterState *);
7373
PyAPI_FUNC(void) _PyInterpreterState_IDIncref(PyInterpreterState *);
7474
PyAPI_FUNC(void) _PyInterpreterState_IDDecref(PyInterpreterState *);
7575

76-
77-
/* cross-interpreter data */
78-
79-
struct _xid;
80-
81-
// _PyCrossInterpreterData is similar to Py_buffer as an effectively
82-
// opaque struct that holds data outside the object machinery. This
83-
// is necessary to pass between interpreters in the same process.
84-
typedef struct _xid {
85-
// data is the cross-interpreter-safe derivation of a Python object
86-
// (see _PyObject_GetCrossInterpreterData). It will be NULL if the
87-
// new_object func (below) encodes the data.
88-
void *data;
89-
// obj is the Python object from which the data was derived. This
90-
// is non-NULL only if the data remains bound to the object in some
91-
// way, such that the object must be "released" (via a decref) when
92-
// the data is released. In that case it is automatically
93-
// incref'ed (to match the automatic decref when releaed).
94-
PyObject *obj;
95-
// interp is the ID of the owning interpreter of the original
96-
// object. It corresponds to the active interpreter when
97-
// _PyObject_GetCrossInterpreterData() was called. This should only
98-
// be set by the cross-interpreter machinery.
99-
//
100-
// We use the ID rather than the PyInterpreterState to avoid issues
101-
// with deleted interpreters.
102-
int64_t interp;
103-
// new_object is a function that returns a new object in the current
104-
// interpreter given the data. The resulting object (a new
105-
// reference) will be equivalent to the original object. This field
106-
// is required.
107-
PyObject *(*new_object)(struct _xid *);
108-
// free is called when the data is released. If it is NULL then
109-
// nothing will be done to free the data. For some types this is
110-
// okay (e.g. bytes) and for those types this field should be set
111-
// to NULL. However, for most the data was allocated just for
112-
// cross-interpreter use, so it must be freed when
113-
// _PyCrossInterpreterData_Release is called or the memory will
114-
// leak. In that case, at the very least this field should be set
115-
// to PyMem_RawFree (the default if not explicitly set to NULL).
116-
// The call will happen with the original interpreter activated.
117-
void (*free)(void *);
118-
} _PyCrossInterpreterData;
119-
120-
typedef int (*crossinterpdatafunc)(PyObject *, _PyCrossInterpreterData *);
121-
PyAPI_FUNC(int) _PyObject_CheckCrossInterpreterData(PyObject *);
122-
123-
PyAPI_FUNC(int) _PyObject_GetCrossInterpreterData(PyObject *, _PyCrossInterpreterData *);
124-
PyAPI_FUNC(PyObject *) _PyCrossInterpreterData_NewObject(_PyCrossInterpreterData *);
125-
PyAPI_FUNC(void) _PyCrossInterpreterData_Release(_PyCrossInterpreterData *);
126-
127-
/* cross-interpreter data registry */
128-
129-
/* For now we use a global registry of shareable classes. An
130-
alternative would be to add a tp_* slot for a class's
131-
crossinterpdatafunc. It would be simpler and more efficient. */
132-
133-
PyAPI_FUNC(int) _PyCrossInterpreterData_Register_Class(PyTypeObject *, crossinterpdatafunc);
134-
PyAPI_FUNC(crossinterpdatafunc) _PyCrossInterpreterData_Lookup(PyObject *);
135-
136-
struct _xidregitem;
137-
138-
struct _xidregitem {
139-
PyTypeObject *cls;
140-
crossinterpdatafunc getdata;
141-
struct _xidregitem *next;
142-
};
143-
144-
14576
/* Full Python runtime state */
14677

14778
typedef struct pyruntimestate {
@@ -163,11 +94,6 @@ typedef struct pyruntimestate {
16394
using a Python int. */
16495
int64_t next_id;
16596
} interpreters;
166-
// XXX Remove this field once we have a tp_* slot.
167-
struct _xidregistry {
168-
PyThread_type_lock mutex;
169-
struct _xidregitem *head;
170-
} xidregistry;
17197

17298
#define NEXITFUNCS 32
17399
void (*exitfuncs[NEXITFUNCS])(void);

0 commit comments

Comments
 (0)
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