@@ -353,6 +353,9 @@ PyAPI_FUNC(const PyConfig*) _Py_GetConfig(void);
353
353
// is necessary to pass safely between interpreters in the same process.
354
354
typedef struct _xid _PyCrossInterpreterData ;
355
355
356
+ typedef PyObject * (* xid_newobjectfunc )(_PyCrossInterpreterData * );
357
+ typedef void (* xid_freefunc )(void * );
358
+
356
359
struct _xid {
357
360
// data is the cross-interpreter-safe derivation of a Python object
358
361
// (see _PyObject_GetCrossInterpreterData). It will be NULL if the
@@ -379,7 +382,7 @@ struct _xid {
379
382
// interpreter given the data. The resulting object (a new
380
383
// reference) will be equivalent to the original object. This field
381
384
// is required.
382
- PyObject * ( * new_object )( _PyCrossInterpreterData * ) ;
385
+ xid_newobjectfunc new_object ;
383
386
// free is called when the data is released. If it is NULL then
384
387
// nothing will be done to free the data. For some types this is
385
388
// okay (e.g. bytes) and for those types this field should be set
@@ -389,9 +392,20 @@ struct _xid {
389
392
// leak. In that case, at the very least this field should be set
390
393
// to PyMem_RawFree (the default if not explicitly set to NULL).
391
394
// The call will happen with the original interpreter activated.
392
- void ( * free )( void * ) ;
395
+ xid_freefunc free ;
393
396
};
394
397
398
+ PyAPI_FUNC (void ) _PyCrossInterpreterData_Init (
399
+ _PyCrossInterpreterData * data ,
400
+ PyInterpreterState * interp , void * shared , PyObject * obj ,
401
+ xid_newobjectfunc new_object );
402
+ PyAPI_FUNC (int ) _PyCrossInterpreterData_InitWithSize (
403
+ _PyCrossInterpreterData * ,
404
+ PyInterpreterState * interp , const size_t , PyObject * ,
405
+ xid_newobjectfunc );
406
+ PyAPI_FUNC (void ) _PyCrossInterpreterData_Clear (
407
+ PyInterpreterState * , _PyCrossInterpreterData * );
408
+
395
409
PyAPI_FUNC (int ) _PyObject_GetCrossInterpreterData (PyObject * , _PyCrossInterpreterData * );
396
410
PyAPI_FUNC (PyObject * ) _PyCrossInterpreterData_NewObject (_PyCrossInterpreterData * );
397
411
PyAPI_FUNC (int ) _PyCrossInterpreterData_Release (_PyCrossInterpreterData * );
@@ -400,7 +414,8 @@ PyAPI_FUNC(int) _PyObject_CheckCrossInterpreterData(PyObject *);
400
414
401
415
/* cross-interpreter data registry */
402
416
403
- typedef int (* crossinterpdatafunc )(PyObject * , _PyCrossInterpreterData * );
417
+ typedef int (* crossinterpdatafunc )(PyThreadState * tstate , PyObject * ,
418
+ _PyCrossInterpreterData * );
404
419
405
420
PyAPI_FUNC (int ) _PyCrossInterpreterData_RegisterClass (PyTypeObject * , crossinterpdatafunc );
406
421
PyAPI_FUNC (int ) _PyCrossInterpreterData_UnregisterClass (PyTypeObject * );
0 commit comments