@@ -1278,13 +1278,8 @@ object_is_shareable(PyObject *self, PyObject *args, PyObject *kwds)
12781278 return NULL ;
12791279 }
12801280
1281- PyInterpreterState * interp = PyInterpreterState_Get ();
1282- _PyXIData_lookup_context_t ctx ;
1283- if (_PyXIData_GetLookupContext (interp , & ctx ) < 0 ) {
1284- return NULL ;
1285- }
1286-
1287- if (_PyObject_CheckXIData (& ctx , obj ) == 0 ) {
1281+ PyThreadState * tstate = _PyThreadState_GET ();
1282+ if (_PyObject_CheckXIData (tstate , obj ) == 0 ) {
12881283 Py_RETURN_TRUE ;
12891284 }
12901285 PyErr_Clear ();
@@ -1577,14 +1572,9 @@ The 'interpreters' module provides a more convenient interface.");
15771572static int
15781573module_exec (PyObject * mod )
15791574{
1580- PyInterpreterState * interp = PyInterpreterState_Get ();
1575+ PyThreadState * tstate = _PyThreadState_GET ();
15811576 module_state * state = get_module_state (mod );
15821577
1583- _PyXIData_lookup_context_t ctx ;
1584- if (_PyXIData_GetLookupContext (interp , & ctx ) < 0 ) {
1585- return -1 ;
1586- }
1587-
15881578#define ADD_WHENCE (NAME ) \
15891579 if (PyModule_AddIntConstant(mod, "WHENCE_" #NAME, \
15901580 _PyInterpreterState_WHENCE_##NAME) < 0) \
@@ -1606,7 +1596,8 @@ module_exec(PyObject *mod)
16061596 if (PyModule_AddType (mod , (PyTypeObject * )PyExc_InterpreterNotFoundError ) < 0 ) {
16071597 goto error ;
16081598 }
1609- if (PyModule_AddType (mod , (PyTypeObject * )ctx .PyExc_NotShareableError ) < 0 ) {
1599+ PyObject * exctype = _PyXIData_GetNotShareableErrorType (tstate );
1600+ if (PyModule_AddType (mod , (PyTypeObject * )exctype ) < 0 ) {
16101601 goto error ;
16111602 }
16121603
0 commit comments