diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2025-04-25 14:43:38 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-25 14:43:38 -0600 |
commit | cd9536a0872046cc7c151b61b457975e7718274a (patch) | |
tree | 97aeb24d67a984a1eedd1ef0944463a4b2a3ef05 /Modules/_interpreters_common.h | |
parent | 4c20f46fa011df57190cc19b21bafde1f65e73a7 (diff) | |
download | cpython-cd9536a0872046cc7c151b61b457975e7718274a.tar.gz cpython-cd9536a0872046cc7c151b61b457975e7718274a.zip |
gh-132781: Cleanup Code Related to NotShareableError (gh-132782)
The following are added to the internal C-API:
* _PyErr_FormatV()
* _PyErr_SetModuleNotFoundError()
* _PyXIData_GetNotShareableErrorType()
* _PyXIData_FormatNotShareableError()
We also drop _PyXIData_lookup_context_t and _PyXIData_GetLookupContext().
Diffstat (limited to 'Modules/_interpreters_common.h')
-rw-r--r-- | Modules/_interpreters_common.h | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/Modules/_interpreters_common.h b/Modules/_interpreters_common.h index a6c639feea5..edd65577284 100644 --- a/Modules/_interpreters_common.h +++ b/Modules/_interpreters_common.h @@ -8,24 +8,16 @@ static int ensure_xid_class(PyTypeObject *cls, xidatafunc getdata) { - PyInterpreterState *interp = PyInterpreterState_Get(); - _PyXIData_lookup_context_t ctx; - if (_PyXIData_GetLookupContext(interp, &ctx) < 0) { - return -1; - } - return _PyXIData_RegisterClass(&ctx, cls, getdata); + PyThreadState *tstate = PyThreadState_Get(); + return _PyXIData_RegisterClass(tstate, cls, getdata); } #ifdef REGISTERS_HEAP_TYPES static int clear_xid_class(PyTypeObject *cls) { - PyInterpreterState *interp = PyInterpreterState_Get(); - _PyXIData_lookup_context_t ctx; - if (_PyXIData_GetLookupContext(interp, &ctx) < 0) { - return -1; - } - return _PyXIData_UnregisterClass(&ctx, cls); + PyThreadState *tstate = PyThreadState_Get(); + return _PyXIData_UnregisterClass(tstate, cls); } #endif |