@@ -1279,38 +1279,15 @@ _PyObject_GetCrossInterpreterData(PyObject *obj, _PyCrossInterpreterData *data)
1279
1279
return 0 ;
1280
1280
}
1281
1281
1282
- static void
1282
+ static int
1283
1283
_release_xidata (void * arg )
1284
1284
{
1285
1285
_PyCrossInterpreterData * data = (_PyCrossInterpreterData * )arg ;
1286
1286
if (data -> free != NULL ) {
1287
1287
data -> free (data -> data );
1288
1288
}
1289
1289
Py_XDECREF (data -> obj );
1290
- }
1291
-
1292
- static void
1293
- _call_in_interpreter (PyInterpreterState * interp ,
1294
- void (* func )(void * ), void * arg )
1295
- {
1296
- /* We would use Py_AddPendingCall() if it weren't specific to the
1297
- * main interpreter (see bpo-33608). In the meantime we take a
1298
- * naive approach.
1299
- */
1300
- PyThreadState * save_tstate = NULL ;
1301
- if (interp != _PyInterpreterState_Get ()) {
1302
- // XXX Using the "head" thread isn't strictly correct.
1303
- PyThreadState * tstate = PyInterpreterState_ThreadHead (interp );
1304
- // XXX Possible GILState issues?
1305
- save_tstate = PyThreadState_Swap (tstate );
1306
- }
1307
-
1308
- func (arg );
1309
-
1310
- // Switch back.
1311
- if (save_tstate != NULL ) {
1312
- PyThreadState_Swap (save_tstate );
1313
- }
1290
+ return 0 ;
1314
1291
}
1315
1292
1316
1293
void
@@ -1332,8 +1309,7 @@ _PyCrossInterpreterData_Release(_PyCrossInterpreterData *data)
1332
1309
}
1333
1310
1334
1311
// "Release" the data and/or the object.
1335
- // XXX Use _Py_AddPendingCall().
1336
- _call_in_interpreter (interp , _release_xidata , data );
1312
+ _Py_AddPendingCall (interp , 0 , _release_xidata , data );
1337
1313
}
1338
1314
1339
1315
PyObject *
0 commit comments