mirror of
https://github.com/johndoe6345789/typthon.git
synced 2026-04-24 13:45:05 +00:00
Fix exception patterns and macros
- Fixed _PyExc_ → _TyExc_ globally - Fixed duplicated macro in SimpleExtendsException - Fixed Py ## EXCSTORE ## Object → Ty ## EXCSTORE ## Object in macros These fixes resolve macro expansion issues in exception definitions. Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -11,10 +11,10 @@ extern "C" {
|
||||
|
||||
/* runtime lifecycle */
|
||||
|
||||
extern TyStatus _PyExc_InitState(TyInterpreterState *);
|
||||
extern TyStatus _PyExc_InitGlobalObjects(TyInterpreterState *);
|
||||
extern int _PyExc_InitTypes(TyInterpreterState *);
|
||||
extern void _PyExc_Fini(TyInterpreterState *);
|
||||
extern TyStatus _TyExc_InitState(TyInterpreterState *);
|
||||
extern TyStatus _TyExc_InitGlobalObjects(TyInterpreterState *);
|
||||
extern int _TyExc_InitTypes(TyInterpreterState *);
|
||||
extern void _TyExc_Fini(TyInterpreterState *);
|
||||
|
||||
|
||||
/* other API */
|
||||
@@ -31,7 +31,7 @@ struct _Py_exc_state {
|
||||
TyObject *TyExc_ExceptionGroup;
|
||||
};
|
||||
|
||||
extern void _PyExc_ClearExceptionGroupType(TyInterpreterState *);
|
||||
extern void _TyExc_ClearExceptionGroupType(TyInterpreterState *);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -168,11 +168,11 @@ extern TyObject* _TyErr_FormatFromCauseTstate(
|
||||
const char *format,
|
||||
...);
|
||||
|
||||
extern TyObject* _PyExc_CreateExceptionGroup(
|
||||
extern TyObject* _TyExc_CreateExceptionGroup(
|
||||
const char *msg,
|
||||
TyObject *excs);
|
||||
|
||||
extern TyObject* _PyExc_PrepReraiseStar(
|
||||
extern TyObject* _TyExc_PrepReraiseStar(
|
||||
TyObject *orig,
|
||||
TyObject *excs);
|
||||
|
||||
@@ -195,8 +195,8 @@ Ty_DEPRECATED(3.12) extern void _TyErr_ChainExceptions(TyObject *, TyObject *, T
|
||||
|
||||
// implementation detail for the codeop module.
|
||||
// Exported for test.test_peg_generator.test_c_parser
|
||||
PyAPI_DATA(TyTypeObject) _PyExc_IncompleteInputError;
|
||||
#define TyExc_IncompleteInputError ((TyObject *)(&_PyExc_IncompleteInputError))
|
||||
PyAPI_DATA(TyTypeObject) _TyExc_IncompleteInputError;
|
||||
#define TyExc_IncompleteInputError ((TyObject *)(&_TyExc_IncompleteInputError))
|
||||
|
||||
extern int _PyUnicodeError_GetParams(
|
||||
TyObject *self,
|
||||
|
||||
@@ -30,7 +30,7 @@ extern "C" {
|
||||
#include "pycore_tuple.h" // _TyTuple_HASH_EMPTY
|
||||
|
||||
|
||||
extern TyTypeObject _PyExc_MemoryError;
|
||||
extern TyTypeObject _TyExc_MemoryError;
|
||||
|
||||
|
||||
/* The static initializers defined here should only be used
|
||||
@@ -166,7 +166,7 @@ extern TyTypeObject _PyExc_MemoryError;
|
||||
.h_root = (PyHamtNode*)&_Ty_SINGLETON(hamt_bitmap_node_empty), \
|
||||
}, \
|
||||
.last_resort_memory_error = { \
|
||||
_TyObject_HEAD_INIT(&_PyExc_MemoryError), \
|
||||
_TyObject_HEAD_INIT(&_TyExc_MemoryError), \
|
||||
.args = (TyObject*)&_Ty_SINGLETON(tuple_empty) \
|
||||
}, \
|
||||
}, \
|
||||
|
||||
@@ -654,7 +654,7 @@ static TyTypeObject _TyExc_BaseException = {
|
||||
/* the CPython API expects exceptions to be (TyObject *) - both a hold-over
|
||||
from the previous implementation and also allowing Python objects to be used
|
||||
in the API */
|
||||
TyObject *TyExc_BaseException = (TyObject *)&_PyExc_BaseException;
|
||||
TyObject *TyExc_BaseException = (TyObject *)&_TyExc_BaseException;
|
||||
|
||||
/* note these macros omit the last semicolon so the macro invocation may
|
||||
* include it and not look strange.
|
||||
@@ -672,26 +672,26 @@ static TyTypeObject _TyExc_ ## EXCNAME = { \
|
||||
0, 0, 0, offsetof(TyBaseExceptionObject, dict), \
|
||||
BaseException_init, 0, BaseException_new,\
|
||||
}; \
|
||||
TyObject *TyExc_ ## EXCNAME = (TyObject *)TyExc_ ## EXCNAME = (TyObject *)&_PyExc__TyExc_ ## EXCNAME
|
||||
TyObject *TyExc_ ## EXCNAME = (TyObject *)&_TyExc_ ## EXCNAME
|
||||
|
||||
#define MiddlingExtendsExceptionEx(EXCBASE, EXCNAME, PYEXCNAME, EXCSTORE, EXCDOC) \
|
||||
TyTypeObject _PyExc_ ## EXCNAME = { \
|
||||
TyTypeObject _TyExc_ ## EXCNAME = { \
|
||||
TyVarObject_HEAD_INIT(NULL, 0) \
|
||||
# PYEXCNAME, \
|
||||
sizeof(Py ## EXCSTORE ## Object), \
|
||||
sizeof(Ty ## EXCSTORE ## Object), \
|
||||
0, EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
0, 0, 0, 0, 0, \
|
||||
Ty_TPFLAGS_DEFAULT | Ty_TPFLAGS_BASETYPE | Ty_TPFLAGS_HAVE_GC, \
|
||||
TyDoc_STR(EXCDOC), EXCSTORE ## _traverse, \
|
||||
EXCSTORE ## _clear, 0, 0, 0, 0, 0, 0, 0, &_ ## EXCBASE, \
|
||||
0, 0, 0, offsetof(Py ## EXCSTORE ## Object, dict), \
|
||||
0, 0, 0, offsetof(Ty ## EXCSTORE ## Object, dict), \
|
||||
EXCSTORE ## _init, 0, 0, \
|
||||
};
|
||||
|
||||
#define MiddlingExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDOC) \
|
||||
static MiddlingExtendsExceptionEx( \
|
||||
EXCBASE, EXCNAME, EXCNAME, EXCSTORE, EXCDOC); \
|
||||
TyObject *TyExc_ ## EXCNAME = (TyObject *)TyExc_ ## EXCNAME = (TyObject *)&_PyExc__TyExc_ ## EXCNAME
|
||||
TyObject *TyExc_ ## EXCNAME = (TyObject *)&_TyExc_ ## EXCNAME
|
||||
|
||||
#define ComplexExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCNEW, \
|
||||
EXCMETHODS, EXCMEMBERS, EXCGETSET, \
|
||||
@@ -699,17 +699,17 @@ TyTypeObject _PyExc_ ## EXCNAME = { \
|
||||
static TyTypeObject _TyExc_ ## EXCNAME = { \
|
||||
TyVarObject_HEAD_INIT(NULL, 0) \
|
||||
# EXCNAME, \
|
||||
sizeof(Py ## EXCSTORE ## Object), 0, \
|
||||
sizeof(Ty ## EXCSTORE ## Object), 0, \
|
||||
EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
|
||||
EXCSTR, 0, 0, 0, \
|
||||
Ty_TPFLAGS_DEFAULT | Ty_TPFLAGS_BASETYPE | Ty_TPFLAGS_HAVE_GC, \
|
||||
TyDoc_STR(EXCDOC), EXCSTORE ## _traverse, \
|
||||
EXCSTORE ## _clear, 0, 0, 0, 0, EXCMETHODS, \
|
||||
EXCMEMBERS, EXCGETSET, &_ ## EXCBASE, \
|
||||
0, 0, 0, offsetof(Py ## EXCSTORE ## Object, dict), \
|
||||
0, 0, 0, offsetof(Ty ## EXCSTORE ## Object, dict), \
|
||||
EXCSTORE ## _init, 0, EXCNEW,\
|
||||
}; \
|
||||
TyObject *TyExc_ ## EXCNAME = (TyObject *)TyExc_ ## EXCNAME = (TyObject *)&_PyExc__TyExc_ ## EXCNAME
|
||||
TyObject *TyExc_ ## EXCNAME = (TyObject *)&_TyExc_ ## EXCNAME
|
||||
|
||||
|
||||
/*
|
||||
@@ -996,7 +996,7 @@ error:
|
||||
}
|
||||
|
||||
TyObject *
|
||||
_PyExc_CreateExceptionGroup(const char *msg_str, TyObject *excs)
|
||||
_TyExc_CreateExceptionGroup(const char *msg_str, TyObject *excs)
|
||||
{
|
||||
TyObject *msg = TyUnicode_FromString(msg_str);
|
||||
if (!msg) {
|
||||
@@ -1550,7 +1550,7 @@ is_same_exception_metadata(TyObject *exc1, TyObject *exc2)
|
||||
Returns NULL and sets an exception on failure.
|
||||
*/
|
||||
TyObject *
|
||||
_PyExc_PrepReraiseStar(TyObject *orig, TyObject *excs)
|
||||
_TyExc_PrepReraiseStar(TyObject *orig, TyObject *excs)
|
||||
{
|
||||
/* orig must be a raised & caught exception, so it has a traceback */
|
||||
assert(PyExceptionInstance_Check(orig));
|
||||
@@ -1626,7 +1626,7 @@ _PyExc_PrepReraiseStar(TyObject *orig, TyObject *excs)
|
||||
goto done;
|
||||
}
|
||||
if (TyList_GET_SIZE(raised_list) > 1) {
|
||||
result = _PyExc_CreateExceptionGroup("", raised_list);
|
||||
result = _TyExc_CreateExceptionGroup("", raised_list);
|
||||
}
|
||||
else {
|
||||
result = Ty_NewRef(TyList_GetItem(raised_list, 0));
|
||||
@@ -1675,7 +1675,7 @@ PyUnstable_Exc_PrepReraiseStar(TyObject *orig, TyObject *excs)
|
||||
}
|
||||
Ty_DECREF(tb);
|
||||
|
||||
return _PyExc_PrepReraiseStar(orig, excs);
|
||||
return _TyExc_PrepReraiseStar(orig, excs);
|
||||
}
|
||||
|
||||
static TyMemberDef BaseExceptionGroup_members[] = {
|
||||
@@ -3664,10 +3664,10 @@ static TyTypeObject _TyExc_UnicodeEncodeError = {
|
||||
Ty_TPFLAGS_DEFAULT | Ty_TPFLAGS_BASETYPE | Ty_TPFLAGS_HAVE_GC,
|
||||
TyDoc_STR("Unicode encoding error."), UnicodeError_traverse,
|
||||
UnicodeError_clear, 0, 0, 0, 0, 0, UnicodeError_members,
|
||||
0, &_PyExc_UnicodeError, 0, 0, 0, offsetof(PyUnicodeErrorObject, dict),
|
||||
0, &_TyExc_UnicodeError, 0, 0, 0, offsetof(PyUnicodeErrorObject, dict),
|
||||
UnicodeEncodeError_init, 0, BaseException_new,
|
||||
};
|
||||
TyObject *TyExc_UnicodeEncodeError = (TyObject *)&_PyExc_UnicodeEncodeError;
|
||||
TyObject *TyExc_UnicodeEncodeError = (TyObject *)&_TyExc_UnicodeEncodeError;
|
||||
|
||||
|
||||
/*
|
||||
@@ -3777,10 +3777,10 @@ static TyTypeObject _TyExc_UnicodeDecodeError = {
|
||||
Ty_TPFLAGS_DEFAULT | Ty_TPFLAGS_BASETYPE | Ty_TPFLAGS_HAVE_GC,
|
||||
TyDoc_STR("Unicode decoding error."), UnicodeError_traverse,
|
||||
UnicodeError_clear, 0, 0, 0, 0, 0, UnicodeError_members,
|
||||
0, &_PyExc_UnicodeError, 0, 0, 0, offsetof(PyUnicodeErrorObject, dict),
|
||||
0, &_TyExc_UnicodeError, 0, 0, 0, offsetof(PyUnicodeErrorObject, dict),
|
||||
UnicodeDecodeError_init, 0, BaseException_new,
|
||||
};
|
||||
TyObject *TyExc_UnicodeDecodeError = (TyObject *)&_PyExc_UnicodeDecodeError;
|
||||
TyObject *TyExc_UnicodeDecodeError = (TyObject *)&_TyExc_UnicodeDecodeError;
|
||||
|
||||
TyObject *
|
||||
PyUnicodeDecodeError_Create(
|
||||
@@ -3883,10 +3883,10 @@ static TyTypeObject _TyExc_UnicodeTranslateError = {
|
||||
Ty_TPFLAGS_DEFAULT | Ty_TPFLAGS_BASETYPE | Ty_TPFLAGS_HAVE_GC,
|
||||
TyDoc_STR("Unicode translation error."), UnicodeError_traverse,
|
||||
UnicodeError_clear, 0, 0, 0, 0, 0, UnicodeError_members,
|
||||
0, &_PyExc_UnicodeError, 0, 0, 0, offsetof(PyUnicodeErrorObject, dict),
|
||||
0, &_TyExc_UnicodeError, 0, 0, 0, offsetof(PyUnicodeErrorObject, dict),
|
||||
UnicodeTranslateError_init, 0, BaseException_new,
|
||||
};
|
||||
TyObject *TyExc_UnicodeTranslateError = (TyObject *)&_PyExc_UnicodeTranslateError;
|
||||
TyObject *TyExc_UnicodeTranslateError = (TyObject *)&_TyExc_UnicodeTranslateError;
|
||||
|
||||
TyObject *
|
||||
_PyUnicodeTranslateError_Create(
|
||||
@@ -4010,7 +4010,7 @@ _TyErr_NoMemory(TyThreadState *tstate)
|
||||
{
|
||||
if (Ty_IS_TYPE(TyExc_MemoryError, NULL)) {
|
||||
/* TyErr_NoMemory() has been called before TyExc_MemoryError has been
|
||||
initialized by _PyExc_Init() */
|
||||
initialized by _TyExc_Init() */
|
||||
Ty_FatalError("Out of memory and TyExc_MemoryError is not "
|
||||
"initialized yet");
|
||||
}
|
||||
@@ -4082,7 +4082,7 @@ free_preallocated_memerrors(struct _Py_exc_state *state)
|
||||
}
|
||||
|
||||
|
||||
TyTypeObject _PyExc_MemoryError = {
|
||||
TyTypeObject _TyExc_MemoryError = {
|
||||
TyVarObject_HEAD_INIT(NULL, 0)
|
||||
"MemoryError",
|
||||
sizeof(TyBaseExceptionObject),
|
||||
@@ -4090,11 +4090,11 @@ TyTypeObject _PyExc_MemoryError = {
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
Ty_TPFLAGS_DEFAULT | Ty_TPFLAGS_BASETYPE | Ty_TPFLAGS_HAVE_GC,
|
||||
TyDoc_STR("Out of memory."), BaseException_traverse,
|
||||
BaseException_clear, 0, 0, 0, 0, 0, 0, 0, &_PyExc_Exception,
|
||||
BaseException_clear, 0, 0, 0, 0, 0, 0, 0, &_TyExc_Exception,
|
||||
0, 0, 0, offsetof(TyBaseExceptionObject, dict),
|
||||
BaseException_init, 0, MemoryError_new
|
||||
};
|
||||
TyObject *TyExc_MemoryError = (TyObject *) &_PyExc_MemoryError;
|
||||
TyObject *TyExc_MemoryError = (TyObject *) &_TyExc_MemoryError;
|
||||
|
||||
|
||||
/*
|
||||
@@ -4252,7 +4252,7 @@ struct static_exception {
|
||||
};
|
||||
|
||||
static struct static_exception static_exceptions[] = {
|
||||
#define ITEM(NAME) {&_PyExc_##NAME, #NAME}
|
||||
#define ITEM(NAME) {&_TyExc_##NAME, #NAME}
|
||||
// Level 1
|
||||
ITEM(BaseException),
|
||||
|
||||
@@ -4318,7 +4318,7 @@ static struct static_exception static_exceptions[] = {
|
||||
|
||||
// Level 4: Other subclasses
|
||||
ITEM(IndentationError), // base: SyntaxError(Exception)
|
||||
{&_PyExc_IncompleteInputError, "_IncompleteInputError"}, // base: SyntaxError(Exception)
|
||||
{&_TyExc_IncompleteInputError, "_IncompleteInputError"}, // base: SyntaxError(Exception)
|
||||
ITEM(IndexError), // base: LookupError(Exception)
|
||||
ITEM(KeyError), // base: LookupError(Exception)
|
||||
ITEM(ModuleNotFoundError), // base: ImportError(Exception)
|
||||
@@ -4346,7 +4346,7 @@ static struct static_exception static_exceptions[] = {
|
||||
|
||||
|
||||
int
|
||||
_PyExc_InitTypes(TyInterpreterState *interp)
|
||||
_TyExc_InitTypes(TyInterpreterState *interp)
|
||||
{
|
||||
for (size_t i=0; i < Ty_ARRAY_LENGTH(static_exceptions); i++) {
|
||||
TyTypeObject *exc = static_exceptions[i].exc;
|
||||
@@ -4364,7 +4364,7 @@ _PyExc_InitTypes(TyInterpreterState *interp)
|
||||
|
||||
|
||||
static void
|
||||
_PyExc_FiniTypes(TyInterpreterState *interp)
|
||||
_TyExc_FiniTypes(TyInterpreterState *interp)
|
||||
{
|
||||
for (Ty_ssize_t i=Ty_ARRAY_LENGTH(static_exceptions) - 1; i >= 0; i--) {
|
||||
TyTypeObject *exc = static_exceptions[i].exc;
|
||||
@@ -4374,7 +4374,7 @@ _PyExc_FiniTypes(TyInterpreterState *interp)
|
||||
|
||||
|
||||
TyStatus
|
||||
_PyExc_InitGlobalObjects(TyInterpreterState *interp)
|
||||
_TyExc_InitGlobalObjects(TyInterpreterState *interp)
|
||||
{
|
||||
if (preallocate_memerrors() < 0) {
|
||||
return _TyStatus_NO_MEMORY();
|
||||
@@ -4383,7 +4383,7 @@ _PyExc_InitGlobalObjects(TyInterpreterState *interp)
|
||||
}
|
||||
|
||||
TyStatus
|
||||
_PyExc_InitState(TyInterpreterState *interp)
|
||||
_TyExc_InitState(TyInterpreterState *interp)
|
||||
{
|
||||
struct _Py_exc_state *state = &interp->exc_state;
|
||||
|
||||
@@ -4486,20 +4486,20 @@ _PyBuiltins_AddExceptions(TyObject *bltinmod)
|
||||
}
|
||||
|
||||
void
|
||||
_PyExc_ClearExceptionGroupType(TyInterpreterState *interp)
|
||||
_TyExc_ClearExceptionGroupType(TyInterpreterState *interp)
|
||||
{
|
||||
struct _Py_exc_state *state = &interp->exc_state;
|
||||
Ty_CLEAR(state->TyExc_ExceptionGroup);
|
||||
}
|
||||
|
||||
void
|
||||
_PyExc_Fini(TyInterpreterState *interp)
|
||||
_TyExc_Fini(TyInterpreterState *interp)
|
||||
{
|
||||
struct _Py_exc_state *state = &interp->exc_state;
|
||||
free_preallocated_memerrors(state);
|
||||
Ty_CLEAR(state->errnomap);
|
||||
|
||||
_PyExc_FiniTypes(interp);
|
||||
_TyExc_FiniTypes(interp);
|
||||
}
|
||||
|
||||
int
|
||||
|
||||
@@ -2164,7 +2164,7 @@ _TyEval_ExceptionGroupMatch(_PyInterpreterFrame *frame, TyObject* exc_value,
|
||||
if (excs == NULL) {
|
||||
return -1;
|
||||
}
|
||||
TyObject *wrapped = _PyExc_CreateExceptionGroup("", excs);
|
||||
TyObject *wrapped = _TyExc_CreateExceptionGroup("", excs);
|
||||
Ty_DECREF(excs);
|
||||
if (wrapped == NULL) {
|
||||
return -1;
|
||||
|
||||
@@ -24,7 +24,7 @@ static TyTypeObject _TyExc_InterpreterError = {
|
||||
//.tp_clear = ((TyTypeObject *)TyExc_Exception)->tp_clear,
|
||||
//.tp_base = (TyTypeObject *)TyExc_Exception,
|
||||
};
|
||||
TyObject *TyExc_InterpreterError = (TyObject *)&_PyExc_InterpreterError;
|
||||
TyObject *TyExc_InterpreterError = (TyObject *)&_TyExc_InterpreterError;
|
||||
|
||||
/* InterpreterNotFoundError extends InterpreterError */
|
||||
|
||||
@@ -35,9 +35,9 @@ static TyTypeObject _TyExc_InterpreterNotFoundError = {
|
||||
.tp_flags = Ty_TPFLAGS_DEFAULT | Ty_TPFLAGS_BASETYPE | Ty_TPFLAGS_HAVE_GC,
|
||||
//.tp_traverse = ((TyTypeObject *)TyExc_Exception)->tp_traverse,
|
||||
//.tp_clear = ((TyTypeObject *)TyExc_Exception)->tp_clear,
|
||||
.tp_base = &_PyExc_InterpreterError,
|
||||
.tp_base = &_TyExc_InterpreterError,
|
||||
};
|
||||
TyObject *TyExc_InterpreterNotFoundError = (TyObject *)&_PyExc_InterpreterNotFoundError;
|
||||
TyObject *TyExc_InterpreterNotFoundError = (TyObject *)&_TyExc_InterpreterNotFoundError;
|
||||
|
||||
/* NotShareableError extends TypeError */
|
||||
|
||||
@@ -141,22 +141,22 @@ init_static_exctypes(exceptions_t *state, TyInterpreterState *interp)
|
||||
TyTypeObject *base = (TyTypeObject *)TyExc_Exception;
|
||||
|
||||
// TyExc_InterpreterError
|
||||
_PyExc_InterpreterError.tp_base = base;
|
||||
_PyExc_InterpreterError.tp_traverse = base->tp_traverse;
|
||||
_PyExc_InterpreterError.tp_clear = base->tp_clear;
|
||||
if (_PyStaticType_InitBuiltin(interp, &_PyExc_InterpreterError) < 0) {
|
||||
_TyExc_InterpreterError.tp_base = base;
|
||||
_TyExc_InterpreterError.tp_traverse = base->tp_traverse;
|
||||
_TyExc_InterpreterError.tp_clear = base->tp_clear;
|
||||
if (_PyStaticType_InitBuiltin(interp, &_TyExc_InterpreterError) < 0) {
|
||||
goto error;
|
||||
}
|
||||
state->TyExc_InterpreterError = (TyObject *)&_PyExc_InterpreterError;
|
||||
state->TyExc_InterpreterError = (TyObject *)&_TyExc_InterpreterError;
|
||||
|
||||
// TyExc_InterpreterNotFoundError
|
||||
_PyExc_InterpreterNotFoundError.tp_traverse = base->tp_traverse;
|
||||
_PyExc_InterpreterNotFoundError.tp_clear = base->tp_clear;
|
||||
if (_PyStaticType_InitBuiltin(interp, &_PyExc_InterpreterNotFoundError) < 0) {
|
||||
_TyExc_InterpreterNotFoundError.tp_traverse = base->tp_traverse;
|
||||
_TyExc_InterpreterNotFoundError.tp_clear = base->tp_clear;
|
||||
if (_PyStaticType_InitBuiltin(interp, &_TyExc_InterpreterNotFoundError) < 0) {
|
||||
goto error;
|
||||
}
|
||||
state->TyExc_InterpreterNotFoundError =
|
||||
(TyObject *)&_PyExc_InterpreterNotFoundError;
|
||||
(TyObject *)&_TyExc_InterpreterNotFoundError;
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -171,11 +171,11 @@ fini_static_exctypes(exceptions_t *state, TyInterpreterState *interp)
|
||||
assert(state == &_PyXI_GET_STATE(interp)->exceptions);
|
||||
if (state->TyExc_InterpreterNotFoundError != NULL) {
|
||||
state->TyExc_InterpreterNotFoundError = NULL;
|
||||
_PyStaticType_FiniBuiltin(interp, &_PyExc_InterpreterNotFoundError);
|
||||
_PyStaticType_FiniBuiltin(interp, &_TyExc_InterpreterNotFoundError);
|
||||
}
|
||||
if (state->TyExc_InterpreterError != NULL) {
|
||||
state->TyExc_InterpreterError = NULL;
|
||||
_PyStaticType_FiniBuiltin(interp, &_PyExc_InterpreterError);
|
||||
_PyStaticType_FiniBuiltin(interp, &_TyExc_InterpreterError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -237,7 +237,7 @@ static TyObject *
|
||||
prep_reraise_star(TyThreadState* unused, TyObject *orig, TyObject *excs)
|
||||
{
|
||||
assert(TyList_Check(excs));
|
||||
return _PyExc_PrepReraiseStar(orig, excs);
|
||||
return _TyExc_PrepReraiseStar(orig, excs);
|
||||
}
|
||||
|
||||
static TyObject *
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "pycore_codecs.h" // _PyCodec_Lookup()
|
||||
#include "pycore_context.h" // _TyContext_Init()
|
||||
#include "pycore_dict.h" // _TyDict_Fini()
|
||||
#include "pycore_exceptions.h" // _PyExc_InitTypes()
|
||||
#include "pycore_exceptions.h" // _TyExc_InitTypes()
|
||||
#include "pycore_fileutils.h" // _Ty_ResetForceASCII()
|
||||
#include "pycore_floatobject.h" // _TyFloat_InitTypes()
|
||||
#include "pycore_freelist.h" // _TyObject_ClearFreeLists()
|
||||
@@ -726,16 +726,16 @@ pycore_init_types(TyInterpreterState *interp)
|
||||
return status;
|
||||
}
|
||||
|
||||
if (_PyExc_InitTypes(interp) < 0) {
|
||||
if (_TyExc_InitTypes(interp) < 0) {
|
||||
return _TyStatus_ERR("failed to initialize an exception type");
|
||||
}
|
||||
|
||||
status = _PyExc_InitGlobalObjects(interp);
|
||||
status = _TyExc_InitGlobalObjects(interp);
|
||||
if (_TyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
}
|
||||
|
||||
status = _PyExc_InitState(interp);
|
||||
status = _TyExc_InitState(interp);
|
||||
if (_TyStatus_EXCEPTION(status)) {
|
||||
return status;
|
||||
}
|
||||
@@ -1863,7 +1863,7 @@ finalize_interp_types(TyInterpreterState *interp)
|
||||
_TyUnicode_FiniTypes(interp);
|
||||
_TySys_FiniTypes(interp);
|
||||
_PyXI_FiniTypes(interp);
|
||||
_PyExc_Fini(interp);
|
||||
_TyExc_Fini(interp);
|
||||
_TyFloat_FiniType(interp);
|
||||
_TyLong_FiniTypes(interp);
|
||||
_PyThread_FiniType(interp);
|
||||
@@ -1904,7 +1904,7 @@ finalize_interp_clear(TyThreadState *tstate)
|
||||
int is_main_interp = _Ty_IsMainInterpreter(tstate->interp);
|
||||
|
||||
_PyXI_Fini(tstate->interp);
|
||||
_PyExc_ClearExceptionGroupType(tstate->interp);
|
||||
_TyExc_ClearExceptionGroupType(tstate->interp);
|
||||
_Ty_clear_generic_types(tstate->interp);
|
||||
|
||||
/* Clear interpreter state and all thread states */
|
||||
|
||||
Reference in New Issue
Block a user